fixed http_connection redirection support and added test (still requires lighttp)

This commit is contained in:
Arvid Norberg
2008-01-12 01:41:56 +00:00
parent 388949014f
commit 81302c8fed
4 changed files with 46 additions and 39 deletions

View File

@@ -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;