Allow using custom method names in wxHTTP.

Add wxHTTP::SetMethod().

Also simplify the code by determining the method to use in Connect() instead
of doing it in BuildRequest() itself.

Get rid of the now unused wxHTTP_Req enum.

Closes #15354.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-07-25 21:55:13 +00:00
parent 7e81e3a796
commit 6535170f3d
4 changed files with 44 additions and 40 deletions

View File

@@ -36,6 +36,7 @@ public:
wxString GetHeader(const wxString& header) const;
int GetResponse() const { return m_http_response; }
void SetMethod(const wxString& method) { m_method = method; }
void SetHeader(const wxString& header, const wxString& h_data);
bool SetPostText(const wxString& contentType,
const wxString& data,
@@ -51,19 +52,12 @@ public:
wxDEPRECATED(void SetPostBuffer(const wxString& post_buf));
protected:
enum wxHTTP_Req
{
wxHTTP_GET,
wxHTTP_POST,
wxHTTP_HEAD
};
typedef wxStringToStringHashMap::iterator wxHeaderIterator;
typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator;
typedef wxStringToStringHashMap::iterator wxCookieIterator;
typedef wxStringToStringHashMap::const_iterator wxCookieConstIterator;
bool BuildRequest(const wxString& path, wxHTTP_Req req);
bool BuildRequest(const wxString& path, const wxString& method);
void SendHeaders();
bool ParseHeaders();
@@ -81,6 +75,7 @@ protected:
// internal variables:
wxString m_method;
wxStringToStringHashMap m_cookies;
wxStringToStringHashMap m_headers;