fixed http_connection redirection support and added test (still requires lighttp)
This commit is contained in:
@@ -78,7 +78,7 @@ struct http_connection : boost::enable_shared_from_this<http_connection>, boost:
|
||||
, m_download_quota(0)
|
||||
, m_limiter_timer_active(false)
|
||||
, m_limiter_timer(ios)
|
||||
, m_redirect(true)
|
||||
, m_redirects(5)
|
||||
, m_connection_ticket(-1)
|
||||
, m_cc(cc)
|
||||
{
|
||||
@@ -93,10 +93,10 @@ struct http_connection : boost::enable_shared_from_this<http_connection>, boost:
|
||||
std::string sendbuffer;
|
||||
|
||||
void get(std::string const& url, time_duration timeout = seconds(30)
|
||||
, bool handle_redirect = true);
|
||||
, int handle_redirects = 5);
|
||||
|
||||
void start(std::string const& hostname, std::string const& port
|
||||
, time_duration timeout, bool handle_redirect = true);
|
||||
, time_duration timeout, int handle_redirect = 5);
|
||||
void close();
|
||||
|
||||
tcp::socket const& socket() const { return m_sock; }
|
||||
@@ -153,9 +153,8 @@ private:
|
||||
// as all the quota was used.
|
||||
deadline_timer m_limiter_timer;
|
||||
|
||||
// if set to true, the connection should handle
|
||||
// HTTP redirects.
|
||||
bool m_redirect;
|
||||
// the number of redirects to follow (in sequence)
|
||||
int m_redirects;
|
||||
|
||||
int m_connection_ticket;
|
||||
connection_queue& m_cc;
|
||||
|
Reference in New Issue
Block a user