fixed issue where an http proxy would not be used on redirects

This commit is contained in:
Arvid Norberg 2010-03-02 21:55:34 +00:00
parent beca9b3da5
commit 2ec1c81cd3
2 changed files with 17 additions and 4 deletions

View File

@ -111,6 +111,7 @@
* added support for torrents with odd piece sizes * added support for torrents with odd piece sizes
* fixed issue with disk read cache not being cleared when removing torrents * fixed issue with disk read cache not being cleared when removing torrents
* made the DHT socket bind to the same interface as the session * made the DHT socket bind to the same interface as the session
* fixed issue where an http proxy would not be used on redirects
release 0.14.9 release 0.14.9

View File

@ -117,7 +117,6 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
ps->username + ":" + ps->password).c_str()); ps->username + ":" + ps->password).c_str());
hostname = ps->hostname; hostname = ps->hostname;
port = ps->port; port = ps->port;
ps = 0;
} }
else else
{ {
@ -220,6 +219,17 @@ void http_connection::start(std::string const& hostname, std::string const& port
} }
#endif #endif
// in this case, the upper layer is assumed to have taken
// care of the proxying already. Don't instantiate the socket
// with this proxy
if ((ps->type == proxy_settings::http
|| ps->type == proxy_settings::http_pw)
&& !ssl)
{
ps = 0;
}
proxy_settings null_proxy;
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
if (m_ssl) if (m_ssl)
{ {
@ -236,7 +246,8 @@ void http_connection::start(std::string const& hostname, std::string const& port
else else
#endif #endif
{ {
ret = instantiate_connection(m_resolver.get_io_service(), m_proxy, s->next_layer()); ret = instantiate_connection(m_resolver.get_io_service()
, ps ? *ps : null_proxy, s->next_layer());
} }
TORRENT_ASSERT(ret); TORRENT_ASSERT(ret);
@ -257,12 +268,13 @@ void http_connection::start(std::string const& hostname, std::string const& port
#endif #endif
{ {
ret = instantiate_connection(m_resolver.get_io_service() ret = instantiate_connection(m_resolver.get_io_service()
, m_proxy, *m_sock.get<socket_type>()); , ps ? *ps : null_proxy, *m_sock.get<socket_type>());
} }
TORRENT_ASSERT(ret); TORRENT_ASSERT(ret);
} }
#else #else
bool ret = instantiate_connection(m_resolver.get_io_service(), m_proxy, m_sock); bool ret = instantiate_connection(m_resolver.get_io_service()
, ps ? *ps : null_proxy, m_sock);
TORRENT_ASSERT(ret); TORRENT_ASSERT(ret);
#endif #endif
if (m_bind_addr != address_v4::any()) if (m_bind_addr != address_v4::any())