]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/http.tex
COW cleanup patch (1583966):
[wxWidgets.git] / docs / latex / wx / http.tex
1 \section{\class{wxHTTP}}\label{wxhttp}
2
3 \wxheading{Derived from}
4
5 \helpref{wxProtocol}{wxprotocol}
6
7 \wxheading{Include files}
8
9 <wx/protocol/http.h>
10
11 \wxheading{See also}
12
13 \helpref{wxSocketBase}{wxsocketbase}, \helpref{wxURL}{wxurl}
14
15 % ----------------------------------------------------------------------------
16 % Members
17 % ----------------------------------------------------------------------------
18
19 % ----------------------------------------------------------------------------
20 \membersection{wxHTTP::GetResponse}\label{wxhttpgetresponse}
21
22 \constfunc{int}{GetResponse}{\void}
23
24 Returns the HTTP response code returned by the server. Please refer to
25 \urlref{RFC 2616}{http://www.faqs.org/rfcs/rfc2616.html} for the list of responses.
26
27
28 \membersection{wxHTTP::GetInputStream}\label{wxhttpgetinputstream}
29
30 \func{wxInputStream *}{GetInputStream}{\param{const wxString\&}{ path}}
31
32 Creates a new input stream on the specified path. Notice that this stream is
33 unseekable, i.e. SeekI() and TellI() methods shouldn't be used.
34
35 Note that you can still know the size of the file you are getting using
36 \helpref{wxStreamBase::GetSize()}{wxstreambasegetsize}. However there is a
37 limitation: in HTTP protocol, the size is not always specified so sometimes
38 \texttt{(size\_t)-1} can returned ot indicate that the size is unknown. In such
39 case, you may want to use \helpref{wxInputStream::LastRead()}{wxinputstreamlastread}
40 method in a loop to get the total size.
41
42 \wxheading{Return value}
43
44 Returns the initialized stream. You must delete it yourself once you
45 don't use it anymore and this must be done before the wxHTTP object itself is
46 destroyed. The destructor closes the network connection. The next time you will
47 try to get a file the network connection will have to be reestablished, but you
48 don't have to take care of this since wxHTTP reestablishes it automatically.
49
50 \wxheading{See also}
51
52 \helpref{wxInputStream}{wxinputstream}
53
54 % ----------------------------------------------------------------------------
55
56 \membersection{wxHTTP::SetHeader}\label{wxhttpsetheader}
57
58 \func{void}{SetHeader}{\param{const wxString\&}{ header}, \param{const wxString\&}{ h\_data}}
59
60 It sets data of a field to be sent during the next request to the HTTP server. The field
61 name is specified by {\it header} and the content by {\it h\_data}.
62 This is a low level function and it assumes that you know what you are doing.
63
64 \membersection{wxHTTP::GetHeader}\label{wxhttpgetheader}
65
66 \func{wxString}{GetHeader}{\param{const wxString\&}{ header}}
67
68 Returns the data attached with a field whose name is specified by {\it header}.
69 If the field doesn't exist, it will return an empty string and not a NULL string.
70
71 \wxheading{Note}
72
73 The header is not case-sensitive, i.e. "CONTENT-TYPE" and "content-type"
74 represent the same header.
75