forked from premiere/premiere-libtorrent
fixed potential http compatibility issue
This commit is contained in:
parent
b84e87edf4
commit
6ff2b1b2d4
|
@ -36,6 +36,7 @@ release 0.14.3
|
||||||
were checked
|
were checked
|
||||||
* fixed filename bug when using wide characters
|
* fixed filename bug when using wide characters
|
||||||
* fixed rare crash in peer banning code
|
* fixed rare crash in peer banning code
|
||||||
|
* fixed potential HTTP compatibility issue
|
||||||
|
|
||||||
release 0.14.2
|
release 0.14.2
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
|
||||||
boost::tie(protocol, auth, hostname, port, path, error)
|
boost::tie(protocol, auth, hostname, port, path, error)
|
||||||
= parse_url_components(url);
|
= parse_url_components(url);
|
||||||
|
|
||||||
|
int default_port = protocol == "https" ? 443 : 80;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
callback(asio::error::socket_type_not_supported);
|
callback(asio::error::socket_type_not_supported);
|
||||||
|
@ -99,7 +101,9 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
headers << "GET " << path << " HTTP/1.0\r\n"
|
headers << "GET " << path << " HTTP/1.0\r\n"
|
||||||
"Host: " << hostname << ":" << port << "\r\n";
|
"Host: " << hostname;
|
||||||
|
if (port != default_port) headers << ":" << port;
|
||||||
|
headers << "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!auth.empty())
|
if (!auth.empty())
|
||||||
|
|
Loading…
Reference in New Issue