fixed potential http compatibility issue

This commit is contained in:
Arvid Norberg 2009-02-27 09:03:05 +00:00
parent b84e87edf4
commit 6ff2b1b2d4
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,7 @@ release 0.14.3
were checked
* fixed filename bug when using wide characters
* fixed rare crash in peer banning code
* fixed potential HTTP compatibility issue
release 0.14.2

View File

@ -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)
= parse_url_components(url);
int default_port = protocol == "https" ? 443 : 80;
if (error)
{
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
{
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())