]>
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 | |
371a5b4e | 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 | ||
f4ada568 GL |
18 | #include "wx/list.h" |
19 | #include "wx/protocol/protocol.h" | |
20 | ||
21 | class WXDLLEXPORT wxHTTP : public wxProtocol { | |
22 | DECLARE_DYNAMIC_CLASS(wxHTTP) | |
23 | DECLARE_PROTOCOL(wxHTTP) | |
24 | protected: | |
25 | wxProtocolError m_perr; | |
26 | wxList m_headers; | |
f61815af | 27 | bool m_read, m_proxy_mode; |
f4ada568 GL |
28 | wxSockAddress *m_addr; |
29 | public: | |
30 | wxHTTP(); | |
31 | ~wxHTTP(); | |
32 | ||
33 | bool Connect(const wxString& host); | |
8a2c6ef8 | 34 | bool Connect(wxSockAddress& addr, bool wait); |
f4ada568 GL |
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 | ||
f61815af GL |
43 | void SetProxyMode(bool on); |
44 | ||
f4ada568 GL |
45 | protected: |
46 | typedef enum { | |
a58d5df4 GL |
47 | wxHTTP_GET, |
48 | wxHTTP_HEAD | |
f4ada568 GL |
49 | } wxHTTP_Req; |
50 | bool BuildRequest(const wxString& path, wxHTTP_Req req); | |
51 | void SendHeaders(); | |
52 | bool ParseHeaders(); | |
2fb203e6 VZ |
53 | |
54 | // deletes the header value strings | |
55 | void ClearHeaders(); | |
22f3361e VZ |
56 | |
57 | DECLARE_NO_COPY_CLASS(wxHTTP) | |
f4ada568 GL |
58 | }; |
59 | ||
a5d46b73 VZ |
60 | #endif // wxUSE_PROTOCOL_HTTP |
61 | ||
62 | #endif // _WX_HTTP_H | |
63 |