From 1c7a6772c17dd639d03390f830884e2e122e26c3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 25 Apr 2009 23:38:03 +0000 Subject: [PATCH] include port number in HTTP Host header (closes #10632) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 4 ++++ src/common/http.cpp | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index be39b122fa..ad4c3ef8e9 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -325,6 +325,10 @@ Major new features in this release All: +- Include port number in host header in wxHTTP (Marcin 'Malcom' Malich). + +All (GUI): + - wxHTML: add support for table borders width (Laurent Humbertclaude). i18n: diff --git a/src/common/http.cpp b/src/common/http.cpp index f6a644fda7..145ec61f3c 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -219,7 +219,10 @@ bool wxHTTP::Connect(const wxString& host, unsigned short port) else if (!addr->Service(wxT("http"))) addr->Service(80); - SetHeader(wxT("Host"), host); + wxString hostHdr = host; + if ( port && port != 80 ) + hostHdr << wxT(":") << port; + SetHeader(wxT("Host"), hostHdr); m_lastError = wxPROTO_NOERR; return true; @@ -235,8 +238,14 @@ bool wxHTTP::Connect(const wxSockAddress& addr, bool WXUNUSED(wait)) m_addr = addr.Clone(); wxIPV4address *ipv4addr = wxDynamicCast(&addr, wxIPV4address); - if (ipv4addr) - SetHeader(wxT("Host"), ipv4addr->OrigHostname()); + if ( ipv4addr ) + { + wxString hostHdr = ipv4addr->OrigHostname(); + unsigned short port = ipv4addr->Service(); + if ( port && port != 80 ) + hostHdr << wxT(":") << port; + SetHeader(wxT("Host"), hostHdr); + } m_lastError = wxPROTO_NOERR; return true; -- 2.45.2