]> git.saurik.com Git - wxWidgets.git/blob - interface/protocol/http.h
further wxPenStyle/wxBrushStyle fixes for builds with compat off (partially by Marcin...
[wxWidgets.git] / interface / protocol / http.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: protocol/http.h
3 // Purpose: interface of wxHTTP
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxHTTP
11 @headerfile http.h wx/protocol/http.h
12
13
14 @library{wxnet}
15 @category{net}
16
17 @see wxSocketBase, wxURL
18 */
19 class wxHTTP : public wxProtocol
20 {
21 public:
22 /**
23 Returns the data attached with a field whose name is specified by @e header.
24 If the field doesn't exist, it will return an empty string and not a @NULL
25 string.
26 */
27 wxString GetHeader(const wxString& header);
28
29 /**
30 Creates a new input stream on the specified path. Notice that this stream is
31 unseekable, i.e. SeekI() and TellI() methods shouldn't be used.
32 Note that you can still know the size of the file you are getting using
33 wxStreamBase::GetSize. However there is a
34 limitation: in HTTP protocol, the size is not always specified so sometimes
35 @c (size_t)-1 can returned ot indicate that the size is unknown. In such
36 case, you may want to use wxInputStream::LastRead
37 method in a loop to get the total size.
38
39 @returns Returns the initialized stream. You must delete it yourself once
40 you don't use it anymore and this must be done before
41 the wxHTTP object itself is destroyed. The destructor
42 closes the network connection. The next time you will
43 try to get a file the network connection will have to
44 be reestablished, but you don't have to take care of
45 this since wxHTTP reestablishes it automatically.
46
47 @see wxInputStream
48 */
49 wxInputStream* GetInputStream(const wxString& path);
50
51 /**
52 Returns the HTTP response code returned by the server. Please refer to
53 RFC 2616 for the list of responses.
54 */
55 int GetResponse() const;
56
57 /**
58 It sets data of a field to be sent during the next request to the HTTP server.
59 The field
60 name is specified by @a header and the content by @e h_data.
61 This is a low level function and it assumes that you know what you are doing.
62 */
63 void SetHeader(const wxString& header, const wxString& h_data);
64 };
65