]> git.saurik.com Git - wxWidgets.git/blame - include/wx/protocol/http.h
don't do anything in SetWindowMenu() if we're setting the same menu as we already...
[wxWidgets.git] / include / wx / protocol / http.h
CommitLineData
f4ada568
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: http.h
3// Purpose: HTTP protocol
4// Author: Guilhem Lavaux
dbccd1c2 5// Modified by: Simo Virokannas (authentication, Dec 2005)
f4ada568
GL
6// Created: August 1997
7// RCS-ID: $Id$
8// Copyright: (c) 1997, 1998 Guilhem Lavaux
65571936 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 21class WXDLLIMPEXP_NET wxHTTP : public wxProtocol
71414756 22{
f4ada568 23public:
730b772b
FM
24 wxHTTP();
25 virtual ~wxHTTP();
f4ada568 26
730b772b
FM
27 virtual bool Connect(const wxString& host, unsigned short port);
28 virtual bool Connect(const wxString& host) { return Connect(host, 0); }
29 virtual bool Connect(const wxSockAddress& addr, bool wait);
30 bool Abort();
f4ada568 31
730b772b 32 wxInputStream *GetInputStream(const wxString& path);
f61815af 33
730b772b
FM
34 wxString GetContentType() const;
35 wxString GetHeader(const wxString& header) const;
36 int GetResponse() const { return m_http_response; }
2e622163 37
730b772b
FM
38 void SetHeader(const wxString& header, const wxString& h_data);
39 void SetPostBuffer(const wxString& post_buf);
40 void SetProxyMode(bool on);
dbccd1c2 41
f4ada568 42protected:
730b772b
FM
43 enum wxHTTP_Req
44 {
45 wxHTTP_GET,
46 wxHTTP_POST,
47 wxHTTP_HEAD
48 };
49
50 typedef wxStringToStringHashMap::iterator wxHeaderIterator;
51 typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator;
52
53 bool BuildRequest(const wxString& path, wxHTTP_Req req);
54 void SendHeaders();
55 bool ParseHeaders();
56
57 wxString GenerateAuthString(const wxString& user, const wxString& pass) const;
58
59 // find the header in m_headers
60 wxHeaderIterator FindHeader(const wxString& header);
61 wxHeaderConstIterator FindHeader(const wxString& header) const;
62
63 // deletes the header value strings
64 void ClearHeaders();
65
66
67 // internal variables:
68
69 wxStringToStringHashMap m_headers;
70 bool m_read,
71 m_proxy_mode;
72 wxSockAddress *m_addr;
73 wxString m_post_buf;
74 int m_http_response;
75
76 DECLARE_DYNAMIC_CLASS(wxHTTP)
77 DECLARE_PROTOCOL(wxHTTP)
78 DECLARE_NO_COPY_CLASS(wxHTTP)
f4ada568
GL
79};
80
a5d46b73
VZ
81#endif // wxUSE_PROTOCOL_HTTP
82
83#endif // _WX_HTTP_H
84