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
This commit is contained in:
Vadim Zeitlin
2009-04-25 23:38:03 +00:00
parent 3aaaf1aaa0
commit 1c7a6772c1
2 changed files with 16 additions and 3 deletions

View File

@@ -325,6 +325,10 @@ Major new features in this release
All: All:
- Include port number in host header in wxHTTP (Marcin 'Malcom' Malich).
All (GUI):
- wxHTML: add support for table borders width (Laurent Humbertclaude). - wxHTML: add support for table borders width (Laurent Humbertclaude).
i18n: i18n:

View File

@@ -219,7 +219,10 @@ bool wxHTTP::Connect(const wxString& host, unsigned short port)
else if (!addr->Service(wxT("http"))) else if (!addr->Service(wxT("http")))
addr->Service(80); 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; m_lastError = wxPROTO_NOERR;
return true; return true;
@@ -235,8 +238,14 @@ bool wxHTTP::Connect(const wxSockAddress& addr, bool WXUNUSED(wait))
m_addr = addr.Clone(); m_addr = addr.Clone();
wxIPV4address *ipv4addr = wxDynamicCast(&addr, wxIPV4address); wxIPV4address *ipv4addr = wxDynamicCast(&addr, wxIPV4address);
if (ipv4addr) if ( ipv4addr )
SetHeader(wxT("Host"), ipv4addr->OrigHostname()); {
wxString hostHdr = ipv4addr->OrigHostname();
unsigned short port = ipv4addr->Service();
if ( port && port != 80 )
hostHdr << wxT(":") << port;
SetHeader(wxT("Host"), hostHdr);
}
m_lastError = wxPROTO_NOERR; m_lastError = wxPROTO_NOERR;
return true; return true;