]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/http.cpp
Don't define wxArrayPGProperty as std::vector in STL build.
[wxWidgets.git] / src / common / http.cpp
index da25a7828b236a208c0be98541538d78cdab9846..145ec61f3c8e2ae950ae924cf8524f5629162b60 100644 (file)
@@ -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;
@@ -367,7 +376,7 @@ public:
 protected:
     size_t OnSysRead(void *buffer, size_t bufsize);
 
-    DECLARE_NO_COPY_CLASS(wxHTTPStream)
+    wxDECLARE_NO_COPY_CLASS(wxHTTPStream);
 };
 
 size_t wxHTTPStream::OnSysRead(void *buffer, size_t bufsize)