]> git.saurik.com Git - wxWidgets.git/blame - include/wx/protocol/http.h
Implemented wxDC stack with focus locking and unlocking
[wxWidgets.git] / include / wx / protocol / http.h
CommitLineData
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
df5168c4 18#include "wx/hashmap.h"
f4ada568
GL
19#include "wx/protocol/protocol.h"
20
df5168c4
MB
21WX_DECLARE_EXPORTED_STRING_HASH_MAP( wxString, wxStringToStringHashMap );
22
71414756
VZ
23class WXDLLIMPEXP_BASE wxHTTP : public wxProtocol
24{
f4ada568
GL
25public:
26 wxHTTP();
27 ~wxHTTP();
28
f9133b32 29 bool Connect(const wxString& host, unsigned short port = 0);
8a2c6ef8 30 bool Connect(wxSockAddress& addr, bool wait);
f4ada568
GL
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);
71414756 37 wxString GetHeader(const wxString& header) const;
f9133b32 38 void SetPostBuffer(const wxString& post_buf);
f4ada568 39
f61815af
GL
40 void SetProxyMode(bool on);
41
f4ada568 42protected:
71414756
VZ
43 enum wxHTTP_Req
44 {
a58d5df4 45 wxHTTP_GET,
f9133b32 46 wxHTTP_POST,
a58d5df4 47 wxHTTP_HEAD
71414756
VZ
48 };
49
50 typedef wxStringToStringHashMap::iterator wxHeaderIterator;
51
f4ada568
GL
52 bool BuildRequest(const wxString& path, wxHTTP_Req req);
53 void SendHeaders();
54 bool ParseHeaders();
2fb203e6 55
71414756
VZ
56 // find the header in m_headers
57 wxHeaderIterator FindHeader(const wxString& header) const;
58
2fb203e6
VZ
59 // deletes the header value strings
60 void ClearHeaders();
22f3361e 61
71414756
VZ
62 wxProtocolError m_perr;
63 wxStringToStringHashMap m_headers;
64 bool m_read,
65 m_proxy_mode;
66 wxSockAddress *m_addr;
67 wxString m_post_buf;
68
69 DECLARE_DYNAMIC_CLASS(wxHTTP)
70 DECLARE_PROTOCOL(wxHTTP)
71 DECLARE_NO_COPY_CLASS(wxHTTP)
f4ada568
GL
72};
73
a5d46b73
VZ
74#endif // wxUSE_PROTOCOL_HTTP
75
76#endif // _WX_HTTP_H
77