]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: protocol/http.h | |
e54c96f1 | 3 | // Purpose: interface of wxHTTP |
23324ae1 FM |
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 | |
e54c96f1 | 17 | @see wxSocketBase, wxURL |
23324ae1 FM |
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. | |
7c913512 | 32 | Note that you can still know the size of the file you are getting using |
23324ae1 FM |
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 | |
7c913512 | 36 | case, you may want to use wxInputStream::LastRead |
23324ae1 FM |
37 | method in a loop to get the total size. |
38 | ||
39 | @returns Returns the initialized stream. You must delete it yourself once | |
4cc4bfaf FM |
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. | |
23324ae1 | 46 | |
4cc4bfaf | 47 | @see wxInputStream |
23324ae1 | 48 | */ |
4cc4bfaf | 49 | wxInputStream* GetInputStream(const wxString& path); |
23324ae1 FM |
50 | |
51 | /** | |
52 | Returns the HTTP response code returned by the server. Please refer to | |
53 | RFC 2616 for the list of responses. | |
54 | */ | |
328f5751 | 55 | int GetResponse() const; |
23324ae1 FM |
56 | |
57 | /** | |
58 | It sets data of a field to be sent during the next request to the HTTP server. | |
59 | The field | |
4cc4bfaf | 60 | name is specified by @a header and the content by @e h_data. |
23324ae1 FM |
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 | }; | |
e54c96f1 | 65 |