wxHTTP::GetResponse() added (patch 794394)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23762 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-09-20 23:55:32 +00:00
parent 9473e9a437
commit 2e622163d0
4 changed files with 19 additions and 1 deletions

View File

@@ -43,9 +43,10 @@ OTHER CHANGES
2.5.1 2.5.1
----- -----
Base: All:
- wxDateTime::ParseDateTime() implemented (Linus McCabe) - wxDateTime::ParseDateTime() implemented (Linus McCabe)
- wxHTTP::GetResponse() added (David Nock)
All (GUI): All (GUI):
@@ -56,6 +57,7 @@ wxMSW:
- fixed wxTE_*WRAP styles handling - fixed wxTE_*WRAP styles handling
- wxTextCtrl::GetValue() works with text in non default encoding - wxTextCtrl::GetValue() works with text in non default encoding
- changed wxCrashReport to generate minidumps instead of text files
wxGTK: wxGTK:

View File

@@ -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} \membersection{wxHTTP::GetInputStream}\label{wxhttpgetinputstream}
\func{wxInputStream *}{GetInputStream}{\param{const wxString\&}{ path}} \func{wxInputStream *}{GetInputStream}{\param{const wxString\&}{ path}}

View File

@@ -41,6 +41,8 @@ public:
void SetProxyMode(bool on); void SetProxyMode(bool on);
int GetResponse() { return m_http_response; }
protected: protected:
enum wxHTTP_Req enum wxHTTP_Req
{ {
@@ -67,6 +69,7 @@ protected:
m_proxy_mode; m_proxy_mode;
wxSockAddress *m_addr; wxSockAddress *m_addr;
wxString m_post_buf; wxString m_post_buf;
int m_http_response;
DECLARE_DYNAMIC_CLASS(wxHTTP) DECLARE_DYNAMIC_CLASS(wxHTTP)
DECLARE_PROTOCOL(wxHTTP) DECLARE_PROTOCOL(wxHTTP)

View File

@@ -44,6 +44,7 @@ wxHTTP::wxHTTP()
m_read = FALSE; m_read = FALSE;
m_proxy_mode = FALSE; m_proxy_mode = FALSE;
m_post_buf = wxEmptyString; m_post_buf = wxEmptyString;
m_http_response = 0;
SetNotify(wxSOCKET_LOST_FLAG); SetNotify(wxSOCKET_LOST_FLAG);
} }
@@ -213,6 +214,8 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
return FALSE; return FALSE;
} }
m_http_response = 0;
// If there is no User-Agent defined, define it. // If there is no User-Agent defined, define it.
if (GetHeader(wxT("User-Agent")).IsNull()) if (GetHeader(wxT("User-Agent")).IsNull())
SetHeader(wxT("User-Agent"), wxT("wxWindows 2.x")); SetHeader(wxT("User-Agent"), wxT("wxWindows 2.x"));
@@ -256,6 +259,8 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
token.NextToken(); token.NextToken();
tmp_str2 = token.NextToken(); tmp_str2 = token.NextToken();
m_http_response = wxAtoi(tmp_str2);
switch (tmp_str2[0u]) { switch (tmp_str2[0u]) {
case wxT('1'): case wxT('1'):
/* INFORMATION / SUCCESS */ /* INFORMATION / SUCCESS */