Moved all interface headers into a 'wx' subdirectory for proper use of Doxygen path...
[wxWidgets.git] / interface / wx / 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 wxHTTP can be used to establish a connection to an HTTP server.
14
15 @library{wxnet}
16 @category{net}
17
18 @see wxSocketBase, wxURL
19 */
20 class wxHTTP : public wxProtocol
21 {
22 public:
23 /**
24 Returns the data attached with a field whose name is specified by @e header.
25 If the field doesn't exist, it will return an empty string and not a @NULL string.
26
27 @note
28 The header is not case-sensitive, i.e. "CONTENT-TYPE" and "content-type"
29 represent the same header.
30 */
31 wxString GetHeader(const wxString& header);
32
33 /**
34 Creates a new input stream on the specified path.
35
36 Notice that this stream is unseekable, i.e. SeekI() and TellI() methods
37 shouldn't be used.
38
39 Note that you can still know the size of the file you are getting using
40 wxStreamBase::GetSize(). However there is a limitation: in HTTP protocol,
41 the size is not always specified so sometimes @c (size_t)-1 can returned to
42 indicate that the size is unknown.
43 In such case, you may want to use wxInputStream::LastRead() method in a loop
44 to get the total size.
45
46 @return Returns the initialized stream. You must delete it yourself
47 once you don't use it anymore and this must be done before
48 the wxHTTP object itself is destroyed. The destructor
49 closes the network connection. The next time you will
50 try to get a file the network connection will have to
51 be reestablished, but you don't have to take care of
52 this since wxHTTP reestablishes it automatically.
53
54 @see wxInputStream
55 */
56 wxInputStream* GetInputStream(const wxString& path);
57
58 /**
59 Returns the HTTP response code returned by the server.
60
61 Please refer to RFC 2616 for the list of responses.
62 */
63 int GetResponse() const;
64
65 /**
66 It sets data of a field to be sent during the next request to the HTTP server.
67
68 The field name is specified by @a header and the content by @e h_data.
69 This is a low level function and it assumes that you know what you are doing.
70 */
71 void SetHeader(const wxString& header, const wxString& h_data);
72 };
73