From 6ff2b1b2d4ef99e1df2ad71eed2bf78811bf351b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 27 Feb 2009 09:03:05 +0000 Subject: [PATCH] fixed potential http compatibility issue --- ChangeLog | 1 + src/http_connection.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 69693d964..00f241388 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/http_connection.cpp b/src/http_connection.cpp index cbaacb09c..a97540a95 100644 --- a/src/http_connection.cpp +++ b/src/http_connection.cpp @@ -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())