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