1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: HTTP protocol
4 // Author: Guilhem Lavaux
5 // Modified by: Simo Virokannas (authentication, Dec 2005)
6 // Created: August 1997
8 // Copyright: (c) 1997, 1998 Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #if wxUSE_PROTOCOL_HTTP
18 #include "wx/hashmap.h"
19 #include "wx/protocol/protocol.h"
21 class WXDLLIMPEXP_NET wxHTTP
: public wxProtocol
27 virtual bool Connect(const wxString
& host
, unsigned short port
);
28 virtual bool Connect(const wxString
& host
) { return Connect(host
, 0); }
29 virtual bool Connect(const wxSockAddress
& addr
, bool wait
);
32 wxInputStream
*GetInputStream(const wxString
& path
);
34 wxString
GetContentType() const;
35 wxString
GetHeader(const wxString
& header
) const;
36 int GetResponse() const { return m_http_response
; }
38 void SetHeader(const wxString
& header
, const wxString
& h_data
);
39 void SetPostBuffer(const wxString
& post_buf
);
40 void SetProxyMode(bool on
);
50 typedef wxStringToStringHashMap::iterator wxHeaderIterator
;
51 typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator
;
53 bool BuildRequest(const wxString
& path
, wxHTTP_Req req
);
57 wxString
GenerateAuthString(const wxString
& user
, const wxString
& pass
) const;
59 // find the header in m_headers
60 wxHeaderIterator
FindHeader(const wxString
& header
);
61 wxHeaderConstIterator
FindHeader(const wxString
& header
) const;
63 // deletes the header value strings
67 // internal variables:
69 wxStringToStringHashMap m_headers
;
72 wxSockAddress
*m_addr
;
76 DECLARE_DYNAMIC_CLASS(wxHTTP
)
77 DECLARE_PROTOCOL(wxHTTP
)
78 DECLARE_NO_COPY_CLASS(wxHTTP
)
81 #endif // wxUSE_PROTOCOL_HTTP