Added GSocket_Init and GSocket_Cleanup
[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 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;
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 protected:
40 typedef enum {
41 wxHTTP_GET,
42 wxHTTP_HEAD
43 } wxHTTP_Req;
44 bool BuildRequest(const wxString& path, wxHTTP_Req req);
45 void SendHeaders();
46 bool ParseHeaders();
47 };
48
49 #endif