X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1759ff9e918d43734793c67328af21203924931f..510649e4d5e8eaf8967ddd082f3eb5945471eb5e:/src/common/http.cpp diff --git a/src/common/http.cpp b/src/common/http.cpp index 779472541d..06cfbd02e8 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -10,27 +10,25 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "http.h" + #pragma implementation "http.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #if wxUSE_SOCKETS -#ifndef WX_PRECOMP -#endif - #include #include #include "wx/string.h" #include "wx/tokenzr.h" #include "wx/socket.h" #include "wx/protocol/protocol.h" +#include "wx/url.h" #include "wx/protocol/http.h" #include "wx/sckstrm.h" @@ -130,7 +128,7 @@ bool wxHTTP::ParseHeaders() break; tokenzr.SetString(line, " :\t\n\r"); - if (!tokenzr.HasMoreToken()) + if (!tokenzr.HasMoreTokens()) return FALSE; wxString left_str = tokenzr.GetNextToken(); @@ -181,13 +179,14 @@ bool wxHTTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait)) bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) { - char *tmp_buf; - char buf[HTTP_BSIZE]; - const wxWX2MBbuf pathbuf = path.mb_str(); + wxChar *tmp_buf; + wxChar buf[200]; + wxWX2MBbuf pathbuf(200); + wxString tmp_str; switch (req) { case wxHTTP_GET: - tmp_buf = "GET"; + tmp_buf = _T("GET"); break; default: return FALSE; @@ -197,13 +196,12 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) SetFlags(NONE); Notify(FALSE); - sprintf(buf, "%s %s\n\r", tmp_buf, (const char*) pathbuf); - Write(buf, strlen(buf)); + tmp_str = wxURL::ConvertToValidURI(path); + wxSprintf(buf, _T("%s %s\n\r"), tmp_buf, tmp_str.GetData()); + pathbuf = wxConvLibc.cWX2MB(buf); + Write(pathbuf, strlen(pathbuf)); SendHeaders(); - sprintf(buf, "\n\r"); - Write(buf, strlen(buf)); - - wxString tmp_str; + Write("\n\r", 2); m_error = GetLine(this, tmp_str); if (m_error != wxPROTO_NOERR) {