]>
Commit | Line | Data |
---|---|---|
f4ada568 GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: http.h | |
3 | // Purpose: HTTP protocol | |
4 | // Author: Guilhem Lavaux | |
5 | // Modified by: | |
6 | // Created: August 1997 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1997, 1998 Guilhem Lavaux | |
65571936 | 9 | // Licence: wxWindows licence |
f4ada568 GL |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | #ifndef _WX_HTTP_H | |
12 | #define _WX_HTTP_H | |
13 | ||
a5d46b73 VZ |
14 | #include "wx/defs.h" |
15 | ||
16 | #if wxUSE_PROTOCOL_HTTP | |
17 | ||
df5168c4 | 18 | #include "wx/hashmap.h" |
f4ada568 GL |
19 | #include "wx/protocol/protocol.h" |
20 | ||
7c4728f6 VS |
21 | WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap, |
22 | class WXDLLIMPEXP_NET ); | |
df5168c4 | 23 | |
7c4728f6 | 24 | class WXDLLIMPEXP_NET wxHTTP : public wxProtocol |
71414756 | 25 | { |
f4ada568 GL |
26 | public: |
27 | wxHTTP(); | |
28 | ~wxHTTP(); | |
29 | ||
0e4acbd4 JS |
30 | virtual bool Connect(const wxString& host, unsigned short port); |
31 | virtual bool Connect(const wxString& host) { return Connect(host, 0); } | |
32 | virtual bool Connect(wxSockAddress& addr, bool wait); | |
f4ada568 GL |
33 | bool Abort(); |
34 | wxInputStream *GetInputStream(const wxString& path); | |
35 | inline wxProtocolError GetError() { return m_perr; } | |
36 | wxString GetContentType(); | |
37 | ||
38 | void SetHeader(const wxString& header, const wxString& h_data); | |
71414756 | 39 | wxString GetHeader(const wxString& header) const; |
f9133b32 | 40 | void SetPostBuffer(const wxString& post_buf); |
f4ada568 | 41 | |
f61815af GL |
42 | void SetProxyMode(bool on); |
43 | ||
2e622163 VZ |
44 | int GetResponse() { return m_http_response; } |
45 | ||
f4ada568 | 46 | protected: |
71414756 VZ |
47 | enum wxHTTP_Req |
48 | { | |
a58d5df4 | 49 | wxHTTP_GET, |
f9133b32 | 50 | wxHTTP_POST, |
a58d5df4 | 51 | wxHTTP_HEAD |
71414756 VZ |
52 | }; |
53 | ||
54 | typedef wxStringToStringHashMap::iterator wxHeaderIterator; | |
bdcade0a | 55 | typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator; |
71414756 | 56 | |
f4ada568 GL |
57 | bool BuildRequest(const wxString& path, wxHTTP_Req req); |
58 | void SendHeaders(); | |
59 | bool ParseHeaders(); | |
2fb203e6 | 60 | |
71414756 | 61 | // find the header in m_headers |
bdcade0a MB |
62 | wxHeaderIterator FindHeader(const wxString& header); |
63 | wxHeaderConstIterator FindHeader(const wxString& header) const; | |
71414756 | 64 | |
2fb203e6 VZ |
65 | // deletes the header value strings |
66 | void ClearHeaders(); | |
22f3361e | 67 | |
71414756 VZ |
68 | wxProtocolError m_perr; |
69 | wxStringToStringHashMap m_headers; | |
70 | bool m_read, | |
71 | m_proxy_mode; | |
72 | wxSockAddress *m_addr; | |
73 | wxString m_post_buf; | |
2e622163 | 74 | int m_http_response; |
71414756 VZ |
75 | |
76 | DECLARE_DYNAMIC_CLASS(wxHTTP) | |
77 | DECLARE_PROTOCOL(wxHTTP) | |
78 | DECLARE_NO_COPY_CLASS(wxHTTP) | |
f4ada568 GL |
79 | }; |
80 | ||
a5d46b73 VZ |
81 | #endif // wxUSE_PROTOCOL_HTTP |
82 | ||
83 | #endif // _WX_HTTP_H | |
84 |