]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: protocol/http.h | |
3 | // Purpose: documentation for wxHTTP class | |
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 | |
7c913512 FM |
12 | |
13 | ||
23324ae1 FM |
14 | @library{wxnet} |
15 | @category{net} | |
7c913512 | 16 | |
23324ae1 FM |
17 | @seealso |
18 | 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 | |
26 | string. | |
27 | */ | |
28 | wxString GetHeader(const wxString& header); | |
29 | ||
30 | /** | |
31 | Creates a new input stream on the specified path. Notice that this stream is | |
32 | unseekable, i.e. SeekI() and TellI() methods shouldn't be used. | |
33 | ||
7c913512 | 34 | Note that you can still know the size of the file you are getting using |
23324ae1 FM |
35 | wxStreamBase::GetSize. However there is a |
36 | limitation: in HTTP protocol, the size is not always specified so sometimes | |
37 | @c (size_t)-1 can returned ot indicate that the size is unknown. In such | |
7c913512 | 38 | case, you may want to use wxInputStream::LastRead |
23324ae1 FM |
39 | method in a loop to get the total size. |
40 | ||
41 | @returns Returns the initialized stream. You must delete it yourself once | |
42 | you don't use it anymore and this must be done before | |
43 | the wxHTTP object itself is destroyed. The destructor | |
44 | closes the network connection. The next time you will | |
45 | try to get a file the network connection will have to | |
46 | be reestablished, but you don't have to take care of | |
47 | this since wxHTTP reestablishes it automatically. | |
48 | ||
49 | @sa wxInputStream | |
50 | */ | |
51 | wxInputStream * GetInputStream(const wxString& path); | |
52 | ||
53 | /** | |
54 | Returns the HTTP response code returned by the server. Please refer to | |
55 | RFC 2616 for the list of responses. | |
56 | */ | |
57 | int GetResponse(); | |
58 | ||
59 | /** | |
60 | It sets data of a field to be sent during the next request to the HTTP server. | |
61 | The field | |
62 | name is specified by @e header and the content by @e h_data. | |
63 | This is a low level function and it assumes that you know what you are doing. | |
64 | */ | |
65 | void SetHeader(const wxString& header, const wxString& h_data); | |
66 | }; |