]> git.saurik.com Git - wxWidgets.git/blob - include/wx/protocol/http.h
fixes for moving wxHTML files into their own DLL
[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/list.h"
19 #include "wx/protocol/protocol.h"
20
21 class WXDLLIMPEXP_BASE wxHTTP : public wxProtocol {
22 DECLARE_DYNAMIC_CLASS(wxHTTP)
23 DECLARE_PROTOCOL(wxHTTP)
24 protected:
25 wxProtocolError m_perr;
26 wxList m_headers;
27 bool m_read, m_proxy_mode;
28 wxSockAddress *m_addr;
29 public:
30 wxHTTP();
31 ~wxHTTP();
32
33 bool Connect(const wxString& host);
34 bool Connect(wxSockAddress& addr, bool wait);
35 bool Abort();
36 wxInputStream *GetInputStream(const wxString& path);
37 inline wxProtocolError GetError() { return m_perr; }
38 wxString GetContentType();
39
40 void SetHeader(const wxString& header, const wxString& h_data);
41 wxString GetHeader(const wxString& header);
42
43 void SetProxyMode(bool on);
44
45 protected:
46 typedef enum {
47 wxHTTP_GET,
48 wxHTTP_HEAD
49 } wxHTTP_Req;
50 bool BuildRequest(const wxString& path, wxHTTP_Req req);
51 void SendHeaders();
52 bool ParseHeaders();
53
54 // deletes the header value strings
55 void ClearHeaders();
56
57 DECLARE_NO_COPY_CLASS(wxHTTP)
58 };
59
60 #endif // wxUSE_PROTOCOL_HTTP
61
62 #endif // _WX_HTTP_H
63