]>
Commit | Line | Data |
---|---|---|
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 license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | #ifndef _WX_HTTP_H | |
12 | #define _WX_HTTP_H | |
13 | ||
14 | #include "wx/list.h" | |
15 | #include "wx/protocol/protocol.h" | |
16 | ||
17 | class WXDLLEXPORT wxHTTP : public wxProtocol { | |
18 | DECLARE_DYNAMIC_CLASS(wxHTTP) | |
19 | DECLARE_PROTOCOL(wxHTTP) | |
20 | protected: | |
21 | wxProtocolError m_perr; | |
22 | wxList m_headers; | |
23 | bool m_read, m_proxy_mode; | |
24 | wxSockAddress *m_addr; | |
25 | public: | |
26 | wxHTTP(); | |
27 | ~wxHTTP(); | |
28 | ||
29 | bool Connect(const wxString& host); | |
30 | bool Connect(wxSockAddress& addr, bool wait); | |
31 | bool Abort(); | |
32 | wxInputStream *GetInputStream(const wxString& path); | |
33 | inline wxProtocolError GetError() { return m_perr; } | |
34 | wxString GetContentType(); | |
35 | ||
36 | void SetHeader(const wxString& header, const wxString& h_data); | |
37 | wxString GetHeader(const wxString& header); | |
38 | ||
39 | void SetProxyMode(bool on); | |
40 | ||
41 | protected: | |
42 | typedef enum { | |
43 | wxHTTP_GET, | |
44 | wxHTTP_HEAD | |
45 | } wxHTTP_Req; | |
46 | bool BuildRequest(const wxString& path, wxHTTP_Req req); | |
47 | void SendHeaders(); | |
48 | bool ParseHeaders(); | |
49 | }; | |
50 | ||
51 | #endif |