From: Vadim Zeitlin Date: Sat, 20 Sep 2003 23:55:32 +0000 (+0000) Subject: wxHTTP::GetResponse() added (patch 794394) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2e622163d05d0813bd6fa4223c18e0ec2f6dc074 wxHTTP::GetResponse() added (patch 794394) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23762 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 6c24cf5a64..6ea5fd429e 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -43,9 +43,10 @@ OTHER CHANGES 2.5.1 ----- -Base: +All: - wxDateTime::ParseDateTime() implemented (Linus McCabe) +- wxHTTP::GetResponse() added (David Nock) All (GUI): @@ -56,6 +57,7 @@ wxMSW: - fixed wxTE_*WRAP styles handling - wxTextCtrl::GetValue() works with text in non default encoding +- changed wxCrashReport to generate minidumps instead of text files wxGTK: diff --git a/docs/latex/wx/http.tex b/docs/latex/wx/http.tex index 00879c582b..71b6829217 100644 --- a/docs/latex/wx/http.tex +++ b/docs/latex/wx/http.tex @@ -17,6 +17,14 @@ % ---------------------------------------------------------------------------- % ---------------------------------------------------------------------------- +\membersection{wxHTTP::GetResponse}\label{wxhttpgetresponse} + +\constfunc{int}{GetResponse}{\void} + +Returns the HTTP response code returned by the server. Please refer to the RFC +2616 for the list of the responses. + + \membersection{wxHTTP::GetInputStream}\label{wxhttpgetinputstream} \func{wxInputStream *}{GetInputStream}{\param{const wxString\&}{ path}} diff --git a/include/wx/protocol/http.h b/include/wx/protocol/http.h index 11fef8e09d..762633ead7 100644 --- a/include/wx/protocol/http.h +++ b/include/wx/protocol/http.h @@ -41,6 +41,8 @@ public: void SetProxyMode(bool on); + int GetResponse() { return m_http_response; } + protected: enum wxHTTP_Req { @@ -67,6 +69,7 @@ protected: m_proxy_mode; wxSockAddress *m_addr; wxString m_post_buf; + int m_http_response; DECLARE_DYNAMIC_CLASS(wxHTTP) DECLARE_PROTOCOL(wxHTTP) diff --git a/src/common/http.cpp b/src/common/http.cpp index 3f5a86b4ae..63e0fb4fb9 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -44,6 +44,7 @@ wxHTTP::wxHTTP() m_read = FALSE; m_proxy_mode = FALSE; m_post_buf = wxEmptyString; + m_http_response = 0; SetNotify(wxSOCKET_LOST_FLAG); } @@ -213,6 +214,8 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) return FALSE; } + m_http_response = 0; + // If there is no User-Agent defined, define it. if (GetHeader(wxT("User-Agent")).IsNull()) SetHeader(wxT("User-Agent"), wxT("wxWindows 2.x")); @@ -256,6 +259,8 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) token.NextToken(); tmp_str2 = token.NextToken(); + m_http_response = wxAtoi(tmp_str2); + switch (tmp_str2[0u]) { case wxT('1'): /* INFORMATION / SUCCESS */