]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/http.cpp
wxListbook needs to clean up the wxListCtrl when DeleteAllPages is called.
[wxWidgets.git] / src / common / http.cpp
index 8e620d15d95d917484f05f619b066380fa8392e5..0e7d3a33469e578d1646faa53ed8c0ce66373812 100644 (file)
@@ -218,6 +218,8 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
     break;
   case wxHTTP_POST:
     request = wxT("POST");
+    if ( GetHeader( wxT("Content-Length") ).IsNull() )
+      SetHeader( wxT("Content-Length"), wxString::Format( wxT("%lu"), (unsigned long)m_post_buf.Len() ) );
     break;
   default:
     return FALSE;
@@ -227,10 +229,14 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
 
   // If there is no User-Agent defined, define it.
   if (GetHeader(wxT("User-Agent")).IsNull())
-    SetHeader(wxT("User-Agent"), wxT("wxWindows 2.x"));
+    SetHeader(wxT("User-Agent"), wxT("wxWidgets 2.x"));
 
   SaveState();
-  SetFlags(wxSOCKET_NONE);
+#if wxUSE_THREADS
+  SetFlags( wxThread::IsMain() ? wxSOCKET_NONE : wxSOCKET_BLOCK );
+#else
+  SetFlags( wxSOCKET_NONE );
+#endif
   Notify(FALSE);
 
   wxString buf;
@@ -241,7 +247,7 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
   Write("\r\n", 2);
 
   if ( req == wxHTTP_POST ) {
-    Write(m_post_buf, m_post_buf.Len());
+    Write(m_post_buf.mbc_str(), m_post_buf.Len());
     m_post_buf = wxEmptyString;
   }