]> git.saurik.com Git - wxWidgets.git/blame - include/wx/protocol/http.h
applied fixes for CodeWarrior compilation
[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
7c4728f6
VS
21WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap,
22 class WXDLLIMPEXP_NET );
df5168c4 23
7c4728f6 24class WXDLLIMPEXP_NET wxHTTP : public wxProtocol
71414756 25{
f4ada568
GL
26public:
27 wxHTTP();
28 ~wxHTTP();
29
f9133b32 30 bool Connect(const wxString& host, unsigned short port = 0);
8a2c6ef8 31 bool Connect(wxSockAddress& addr, bool wait);
f4ada568
GL
32 bool Abort();
33 wxInputStream *GetInputStream(const wxString& path);
34 inline wxProtocolError GetError() { return m_perr; }
35 wxString GetContentType();
36
37 void SetHeader(const wxString& header, const wxString& h_data);
71414756 38 wxString GetHeader(const wxString& header) const;
f9133b32 39 void SetPostBuffer(const wxString& post_buf);
f4ada568 40
f61815af
GL
41 void SetProxyMode(bool on);
42
f4ada568 43protected:
71414756
VZ
44 enum wxHTTP_Req
45 {
a58d5df4 46 wxHTTP_GET,
f9133b32 47 wxHTTP_POST,
a58d5df4 48 wxHTTP_HEAD
71414756
VZ
49 };
50
51 typedef wxStringToStringHashMap::iterator wxHeaderIterator;
52
f4ada568
GL
53 bool BuildRequest(const wxString& path, wxHTTP_Req req);
54 void SendHeaders();
55 bool ParseHeaders();
2fb203e6 56
71414756
VZ
57 // find the header in m_headers
58 wxHeaderIterator FindHeader(const wxString& header) const;
59
2fb203e6
VZ
60 // deletes the header value strings
61 void ClearHeaders();
22f3361e 62
71414756
VZ
63 wxProtocolError m_perr;
64 wxStringToStringHashMap m_headers;
65 bool m_read,
66 m_proxy_mode;
67 wxSockAddress *m_addr;
68 wxString m_post_buf;
69
70 DECLARE_DYNAMIC_CLASS(wxHTTP)
71 DECLARE_PROTOCOL(wxHTTP)
72 DECLARE_NO_COPY_CLASS(wxHTTP)
f4ada568
GL
73};
74
a5d46b73
VZ
75#endif // wxUSE_PROTOCOL_HTTP
76
77#endif // _WX_HTTP_H
78