+ // Use To8BitData() for backwards compatibility in this deprecated method.
+ // The new code should use the other overload or SetPostText() and specify
+ // the encoding to use for the text explicitly.
+ wxScopedCharBuffer scb = post_buf.To8BitData();
+ if ( scb.length() )
+ {
+ m_postBuffer.Clear();
+ m_postBuffer.AppendData(scb.data(), scb.length());
+ }
+}
+
+bool
+wxHTTP::SetPostBuffer(const wxString& contentType,
+ const wxMemoryBuffer& data)
+{
+ m_postBuffer = data;
+ m_contentType = contentType;
+
+ return !m_postBuffer.IsEmpty();
+}
+
+bool
+wxHTTP::SetPostText(const wxString& contentType,
+ const wxString& data,
+ const wxMBConv& conv)
+{
+#if wxUSE_UNICODE
+ wxScopedCharBuffer scb = data.mb_str(conv);
+ const size_t len = scb.length();
+ const char* const buf = scb.data();
+#else // !wxUSE_UNICODE
+ const size_t len = data.length();
+ const char* const buf = data.mb_str(conv);
+#endif // wxUSE_UNICODE/!wxUSE_UNICODE
+
+ if ( !len )
+ return false;
+
+ m_postBuffer.Clear();
+ m_postBuffer.AppendData(buf, len);
+ m_contentType = contentType;
+
+ return true;