]> git.saurik.com Git - wxWidgets.git/blob - include/wx/protocol/http.h
71fd1df60eface0f948c6e8b7da287210a7d8840
[wxWidgets.git] / include / wx / protocol / http.h
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_HTTP_H
12 #define _WX_HTTP_H
13
14 #include "wx/defs.h"
15
16 #if wxUSE_PROTOCOL_HTTP
17
18 #include "wx/hashmap.h"
19 #include "wx/protocol/protocol.h"
20
21 WX_DECLARE_EXPORTED_STRING_HASH_MAP( wxString, wxStringToStringHashMap );
22
23 class WXDLLIMPEXP_BASE wxHTTP : public wxProtocol {
24 DECLARE_DYNAMIC_CLASS(wxHTTP)
25 DECLARE_PROTOCOL(wxHTTP)
26 protected:
27 wxProtocolError m_perr;
28 wxStringToStringHashMap m_headers;
29 bool m_read, m_proxy_mode;
30 wxSockAddress *m_addr;
31 public:
32 wxHTTP();
33 ~wxHTTP();
34
35 bool Connect(const wxString& host);
36 bool Connect(wxSockAddress& addr, bool wait);
37 bool Abort();
38 wxInputStream *GetInputStream(const wxString& path);
39 inline wxProtocolError GetError() { return m_perr; }
40 wxString GetContentType();
41
42 void SetHeader(const wxString& header, const wxString& h_data);
43 wxString GetHeader(const wxString& header);
44
45 void SetProxyMode(bool on);
46
47 protected:
48 typedef enum {
49 wxHTTP_GET,
50 wxHTTP_HEAD
51 } wxHTTP_Req;
52 bool BuildRequest(const wxString& path, wxHTTP_Req req);
53 void SendHeaders();
54 bool ParseHeaders();
55
56 // deletes the header value strings
57 void ClearHeaders();
58
59 DECLARE_NO_COPY_CLASS(wxHTTP)
60 };
61
62 #endif // wxUSE_PROTOCOL_HTTP
63
64 #endif // _WX_HTTP_H
65