~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qhttp.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/network/qhttp.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QHttp Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QHttp Class Reference</h1>
 
21
<p>The QHttp class provides an implementation of the HTTP protocol. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QHttp&gt;</pre><p>Part of the <a href="qtnetwork.html">QtNetwork</a> module.</p>
 
23
<p>Inherits <a href="qobject.html">QObject</a>.</p>
 
24
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
 
25
<ul>
 
26
<li><a href="qhttp-members.html">List of all members, including inherited members</a></li>
 
27
<li><a href="qhttp-obsolete.html">Obsolete members</a></li>
 
28
<li><a href="qhttp-qt3.html">Qt 3 support members</a></li>
 
29
</ul>
 
30
<a name="public-types"></a>
 
31
<h3>Public Types</h3>
 
32
<ul>
 
33
<li><div class="fn"/>enum <b><a href="qhttp.html#Error-enum">Error</a></b> { NoError, HostNotFound, ConnectionRefused, UnexpectedClose, ..., UnknownError }</li>
 
34
<li><div class="fn"/>enum <b><a href="qhttp.html#State-enum">State</a></b> { Unconnected, HostLookup, Connecting, Sending, ..., Closing }</li>
 
35
</ul>
 
36
<a name="public-functions"></a>
 
37
<h3>Public Functions</h3>
 
38
<ul>
 
39
<li><div class="fn"/><b><a href="qhttp.html#QHttp">QHttp</a></b> ( QObject * <i>parent</i> = 0 )</li>
 
40
<li><div class="fn"/><b><a href="qhttp.html#QHttp-2">QHttp</a></b> ( const QString &amp; <i>hostName</i>, quint16 <i>port</i> = 80, QObject * <i>parent</i> = 0 )</li>
 
41
<li><div class="fn"/>virtual <b><a href="qhttp.html#dtor.QHttp">~QHttp</a></b> ()</li>
 
42
<li><div class="fn"/>qint64 <b><a href="qhttp.html#bytesAvailable">bytesAvailable</a></b> () const</li>
 
43
<li><div class="fn"/>void <b><a href="qhttp.html#clearPendingRequests">clearPendingRequests</a></b> ()</li>
 
44
<li><div class="fn"/>int <b><a href="qhttp.html#close">close</a></b> ()</li>
 
45
<li><div class="fn"/>QIODevice * <b><a href="qhttp.html#currentDestinationDevice">currentDestinationDevice</a></b> () const</li>
 
46
<li><div class="fn"/>int <b><a href="qhttp.html#currentId">currentId</a></b> () const</li>
 
47
<li><div class="fn"/>QHttpRequestHeader <b><a href="qhttp.html#currentRequest">currentRequest</a></b> () const</li>
 
48
<li><div class="fn"/>QIODevice * <b><a href="qhttp.html#currentSourceDevice">currentSourceDevice</a></b> () const</li>
 
49
<li><div class="fn"/>Error <b><a href="qhttp.html#error">error</a></b> () const</li>
 
50
<li><div class="fn"/>QString <b><a href="qhttp.html#errorString">errorString</a></b> () const</li>
 
51
<li><div class="fn"/>int <b><a href="qhttp.html#get">get</a></b> ( const QString &amp; <i>path</i>, QIODevice * <i>to</i> = 0 )</li>
 
52
<li><div class="fn"/>bool <b><a href="qhttp.html#hasPendingRequests">hasPendingRequests</a></b> () const</li>
 
53
<li><div class="fn"/>int <b><a href="qhttp.html#head">head</a></b> ( const QString &amp; <i>path</i> )</li>
 
54
<li><div class="fn"/>QHttpResponseHeader <b><a href="qhttp.html#lastResponse">lastResponse</a></b> () const</li>
 
55
<li><div class="fn"/>int <b><a href="qhttp.html#post">post</a></b> ( const QString &amp; <i>path</i>, QIODevice * <i>data</i>, QIODevice * <i>to</i> = 0 )</li>
 
56
<li><div class="fn"/>int <b><a href="qhttp.html#post-2">post</a></b> ( const QString &amp; <i>path</i>, const QByteArray &amp; <i>data</i>, QIODevice * <i>to</i> = 0 )</li>
 
57
<li><div class="fn"/>qint64 <b><a href="qhttp.html#read">read</a></b> ( char * <i>data</i>, qint64 <i>maxlen</i> )</li>
 
58
<li><div class="fn"/>QByteArray <b><a href="qhttp.html#readAll">readAll</a></b> ()</li>
 
59
<li><div class="fn"/>int <b><a href="qhttp.html#request">request</a></b> ( const QHttpRequestHeader &amp; <i>header</i>, QIODevice * <i>data</i> = 0, QIODevice * <i>to</i> = 0 )</li>
 
60
<li><div class="fn"/>int <b><a href="qhttp.html#request-2">request</a></b> ( const QHttpRequestHeader &amp; <i>header</i>, const QByteArray &amp; <i>data</i>, QIODevice * <i>to</i> = 0 )</li>
 
61
<li><div class="fn"/>int <b><a href="qhttp.html#setHost">setHost</a></b> ( const QString &amp; <i>hostName</i>, quint16 <i>port</i> = 80 )</li>
 
62
<li><div class="fn"/>int <b><a href="qhttp.html#setProxy">setProxy</a></b> ( const QString &amp; <i>host</i>, int <i>port</i>, const QString &amp; <i>username</i> = QString(), const QString &amp; <i>password</i> = QString() )</li>
 
63
<li><div class="fn"/>int <b><a href="qhttp.html#setSocket">setSocket</a></b> ( QTcpSocket * <i>socket</i> )</li>
 
64
<li><div class="fn"/>int <b><a href="qhttp.html#setUser">setUser</a></b> ( const QString &amp; <i>userName</i>, const QString &amp; <i>password</i> = QString() )</li>
 
65
<li><div class="fn"/>State <b><a href="qhttp.html#state">state</a></b> () const</li>
 
66
</ul>
 
67
<ul>
 
68
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
69
</ul>
 
70
<a name="public-slots"></a>
 
71
<h3>Public Slots</h3>
 
72
<ul>
 
73
<li><div class="fn"/>void <b><a href="qhttp.html#abort">abort</a></b> ()</li>
 
74
</ul>
 
75
<ul>
 
76
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
77
</ul>
 
78
<a name="signals"></a>
 
79
<h3>Signals</h3>
 
80
<ul>
 
81
<li><div class="fn"/>void <b><a href="qhttp.html#dataReadProgress">dataReadProgress</a></b> ( int <i>done</i>, int <i>total</i> )</li>
 
82
<li><div class="fn"/>void <b><a href="qhttp.html#dataSendProgress">dataSendProgress</a></b> ( int <i>done</i>, int <i>total</i> )</li>
 
83
<li><div class="fn"/>void <b><a href="qhttp.html#done">done</a></b> ( bool <i>error</i> )</li>
 
84
<li><div class="fn"/>void <b><a href="qhttp.html#readyRead">readyRead</a></b> ( const QHttpResponseHeader &amp; <i>resp</i> )</li>
 
85
<li><div class="fn"/>void <b><a href="qhttp.html#requestFinished">requestFinished</a></b> ( int <i>id</i>, bool <i>error</i> )</li>
 
86
<li><div class="fn"/>void <b><a href="qhttp.html#requestStarted">requestStarted</a></b> ( int <i>id</i> )</li>
 
87
<li><div class="fn"/>void <b><a href="qhttp.html#responseHeaderReceived">responseHeaderReceived</a></b> ( const QHttpResponseHeader &amp; <i>resp</i> )</li>
 
88
<li><div class="fn"/>void <b><a href="qhttp.html#stateChanged">stateChanged</a></b> ( int <i>state</i> )</li>
 
89
</ul>
 
90
<ul>
 
91
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
92
</ul>
 
93
<h3>Additional Inherited Members</h3>
 
94
<ul>
 
95
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
96
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
97
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
98
</ul>
 
99
<a name="details"></a>
 
100
<hr />
 
101
<h2>Detailed Description</h2>
 
102
<p>The QHttp class provides an implementation of the HTTP protocol.</p>
 
103
<p>This class provides a direct interface to HTTP that allows you to have more control over the requests and that allows you to access the response header fields.</p>
 
104
<p>The class works asynchronously, so there are no blocking functions. If an operation cannot be executed immediately, the function will still return straight away and the operation will be scheduled for later execution. The results of scheduled operations are reported via signals. This approach depends on the event loop being in operation.</p>
 
105
<p>The operations that can be scheduled (they are called &quot;requests&quot; in the rest of the documentation) are the following: <a href="qhttp.html#setHost">setHost</a>(), <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#head">head</a>() and <a href="qhttp.html#request">request</a>().</p>
 
106
<p>All of these requests return a unique identifier that allows you to keep track of the request that is currently executed. When the execution of a request starts, the <a href="qhttp.html#requestStarted">requestStarted</a>() signal with the identifier is emitted and when the request is finished, the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted with the identifier and a bool that indicates if the request finished with an error.</p>
 
107
<p>To make an HTTP request you must set up suitable HTTP headers. The following example demonstrates, how to request the main HTML page from the Trolltech home page (i.e. the URL <tt>http://www.trolltech.com/index.html</tt>):</p>
 
108
<pre>&nbsp;   QHttpRequestHeader header(&quot;GET&quot;, &quot;/index.html&quot;);
 
109
    header.setValue(&quot;Host&quot;, &quot;www.trolltech.com&quot;);
 
110
    http-&gt;setHost(&quot;www.trolltech.com&quot;);
 
111
    http-&gt;request(header);</pre>
 
112
<p>For the common HTTP requests <tt>GET</tt>, <tt>POST</tt> and <tt>HEAD</tt>, QHttp provides the convenience functions <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>() and <a href="qhttp.html#head">head</a>(). They already use a reasonable header and if you don't have to set special header fields, they are easier to use. The above example can also be written as:</p>
 
113
<pre>&nbsp;   http-&gt;setHost(&quot;www.trolltech.com&quot;); // id == 1
 
114
    http-&gt;get(&quot;/index.html&quot;);           // id == 2</pre>
 
115
<p>For this example the following sequence of signals is emitted (with small variations, depending on network traffic, etc.):</p>
 
116
<pre>&nbsp;   requestStarted(1)
 
117
    requestFinished(1, false)
 
118
 
 
119
    requestStarted(2)
 
120
    stateChanged(Connecting)
 
121
    stateChanged(Sending)
 
122
    dataSendProgress(77, 77)
 
123
    stateChanged(Reading)
 
124
    responseHeaderReceived(responseheader)
 
125
    dataReadProgress(5388, 0)
 
126
    readyRead(responseheader)
 
127
    dataReadProgress(18300, 0)
 
128
    readyRead(responseheader)
 
129
    stateChanged(Connected)
 
130
    requestFinished(2, false)
 
131
 
 
132
    done(false)
 
133
 
 
134
    stateChanged(Closing)
 
135
    stateChanged(Unconnected)</pre>
 
136
<p>The <a href="qhttp.html#dataSendProgress">dataSendProgress</a>() and <a href="qhttp.html#dataReadProgress">dataReadProgress</a>() signals in the above example are useful if you want to show a <a href="qprogressbar.html">progressbar</a> to inform the user about the progress of the download. The second argument is the total size of data. In certain cases it is not possible to know the total amount in advance, in which case the second argument is 0. (If you connect to a <a href="qprogressbar.html">QProgressBar</a> a total of 0 results in a busy indicator.)</p>
 
137
<p>When the response header is read, it is reported with the <a href="qhttp.html#responseHeaderReceived">responseHeaderReceived</a>() signal.</p>
 
138
<p>The <a href="qhttp.html#readyRead">readyRead</a>() signal tells you that there is data ready to be read. The amount of data can then be queried with the <a href="qhttp.html#bytesAvailable">bytesAvailable</a>() function and it can be read with the <a href="qhttp.html#read">read</a>() or <a href="qhttp.html#readAll">readAll</a>() functions.</p>
 
139
<p>If an error occurs during the execution of one of the commands in a sequence of commands, all the pending commands (i.e. scheduled, but not yet executed commands) are cleared and no signals are emitted for them.</p>
 
140
<p>For example, if you have the following sequence of requests</p>
 
141
<pre>&nbsp;   http-&gt;setHost(&quot;www.foo.bar&quot;);       // id == 1
 
142
    http-&gt;get(&quot;/index.html&quot;);           // id == 2
 
143
    http-&gt;post(&quot;register.html&quot;, data);  // id == 3</pre>
 
144
<p>and the <a href="qhttp.html#get">get</a>() request fails because the host lookup fails, then the <a href="qhttp.html#post">post</a>() request is never executed and the signals would look like this:</p>
 
145
<pre>&nbsp;   requestStarted(1)
 
146
    requestFinished(1, false)
 
147
 
 
148
    requestStarted(2)
 
149
    stateChanged(HostLookup)
 
150
    requestFinished(2, true)
 
151
 
 
152
    done(true)
 
153
 
 
154
    stateChanged(Unconnected)</pre>
 
155
<p>You can then get details about the error with the <a href="qhttp.html#error">error</a>() and <a href="qhttp.html#errorString">errorString</a>() functions. Note that only unexpected behavior, like network failure is considered as an error. If the server response contains an error status, like a 404 response, this is reported as a normal response case. So you should always check the <a href="qhttpresponseheader.html#statusCode">status code</a> of the response header.</p>
 
156
<p>The functions <a href="qhttp.html#currentId">currentId</a>() and <a href="qhttp.html#currentRequest">currentRequest</a>() provide more information about the currently executing request.</p>
 
157
<p>The functions <a href="qhttp.html#hasPendingRequests">hasPendingRequests</a>() and <a href="qhttp.html#clearPendingRequests">clearPendingRequests</a>() allow you to query and clear the list of pending requests.</p>
 
158
<p>The <a href="network-http.html">HTTP</a> example illustrates how to write HTTP clients using QHttp.</p>
 
159
<p>See also <a href="networking.html">Network Module</a> and <a href="qftp.html">QFtp</a>.</p>
 
160
<hr />
 
161
<h2>Member Type Documentation</h2>
 
162
<h3 class="fn"><a name="Error-enum"></a>enum QHttp::Error</h3>
 
163
<p>This enum identifies the error that occurred.</p>
 
164
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
165
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
166
<tr><td valign="top"><tt>QHttp::NoError</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">No error occurred.</td></tr>
 
167
<tr><td valign="top"><tt>QHttp::HostNotFound</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The host name lookup failed.</td></tr>
 
168
<tr><td valign="top"><tt>QHttp::ConnectionRefused</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The server refused the connection.</td></tr>
 
169
<tr><td valign="top"><tt>QHttp::UnexpectedClose</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The server closed the connection unexpectedly.</td></tr>
 
170
<tr><td valign="top"><tt>QHttp::InvalidResponseHeader</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">The server sent an invalid response header.</td></tr>
 
171
<tr><td valign="top"><tt>QHttp::WrongContentLength</tt></td><td align="center" valign="top"><tt>6</tt></td><td valign="top">The client could not read the content correctly because an error with respect to the content length occurred.</td></tr>
 
172
<tr><td valign="top"><tt>QHttp::Aborted</tt></td><td align="center" valign="top"><tt>7</tt></td><td valign="top">The request was aborted with <a href="qhttp.html#abort">abort</a>().</td></tr>
 
173
<tr><td valign="top"><tt>QHttp::UnknownError</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">An error other than those specified above occurred.</td></tr>
 
174
</table>
 
175
<p>See also <a href="qhttp.html#error">error</a>().</p>
 
176
<h3 class="fn"><a name="State-enum"></a>enum QHttp::State</h3>
 
177
<p>This enum is used to specify the state the client is in:</p>
 
178
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
179
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
180
<tr><td valign="top"><tt>QHttp::Unconnected</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">There is no connection to the host.</td></tr>
 
181
<tr><td valign="top"><tt>QHttp::HostLookup</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">A host name lookup is in progress.</td></tr>
 
182
<tr><td valign="top"><tt>QHttp::Connecting</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">An attempt to connect to the host is in progress.</td></tr>
 
183
<tr><td valign="top"><tt>QHttp::Sending</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The client is sending its request to the server.</td></tr>
 
184
<tr><td valign="top"><tt>QHttp::Reading</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The client's request has been sent and the client is reading the server's response.</td></tr>
 
185
<tr><td valign="top"><tt>QHttp::Connected</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">The connection to the host is open, but the client is neither sending a request, nor waiting for a response.</td></tr>
 
186
<tr><td valign="top"><tt>QHttp::Closing</tt></td><td align="center" valign="top"><tt>6</tt></td><td valign="top">The connection is closing down, but is not yet closed. (The state will be <tt>Unconnected</tt> when the connection is closed.)</td></tr>
 
187
</table>
 
188
<p>See also <a href="qhttp.html#stateChanged">stateChanged</a>() and <a href="qhttp.html#state">state</a>().</p>
 
189
<hr />
 
190
<h2>Member Function Documentation</h2>
 
191
<h3 class="fn"><a name="QHttp"></a>QHttp::QHttp ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
 
192
<p>Constructs a <a href="qhttp.html">QHttp</a> object. The <i>parent</i> parameter is passed on to the <a href="qobject.html">QObject</a> constructor.</p>
 
193
<h3 class="fn"><a name="QHttp-2"></a>QHttp::QHttp ( const <a href="qstring.html">QString</a> &amp; <i>hostName</i>, <a href="qtglobal.html#quint16-typedef">quint16</a> <i>port</i> = 80, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
 
194
<p>Constructs a <a href="qhttp.html">QHttp</a> object. Subsequent requests are done by connecting to the server <i>hostName</i> on port <i>port</i>.</p>
 
195
<p>The <i>parent</i> parameter is passed on to the <a href="qobject.html">QObject</a> constructor.</p>
 
196
<p>See also <a href="qhttp.html#setHost">setHost</a>().</p>
 
197
<h3 class="fn"><a name="dtor.QHttp"></a>QHttp::~QHttp ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
198
<p>Destroys the <a href="qhttp.html">QHttp</a> object. If there is an open connection, it is closed.</p>
 
199
<h3 class="fn"><a name="abort"></a>void QHttp::abort ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
200
<p>Aborts the current request and deletes all scheduled requests.</p>
 
201
<p>For the current request, the <a href="qhttp.html#requestFinished">requestFinished</a>() signal with the <tt>error</tt> argument <tt>true</tt> is emitted. For all other requests that are affected by the abort(), no signals are emitted.</p>
 
202
<p>Since this slot also deletes the scheduled requests, there are no requests left and the <a href="qhttp.html#done">done</a>() signal is emitted (with the <tt>error</tt> argument <tt>true</tt>).</p>
 
203
<p>See also <a href="qhttp.html#clearPendingRequests">clearPendingRequests</a>().</p>
 
204
<h3 class="fn"><a name="bytesAvailable"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QHttp::bytesAvailable () const</h3>
 
205
<p>Returns the number of bytes that can be read from the response content at the moment.</p>
 
206
<p>See also <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#readyRead">readyRead</a>(), <a href="qhttp.html#read">read</a>(), and <a href="qhttp.html#readAll">readAll</a>().</p>
 
207
<h3 class="fn"><a name="clearPendingRequests"></a>void QHttp::clearPendingRequests ()</h3>
 
208
<p>Deletes all pending requests from the list of scheduled requests. This does not affect the request that is being executed. If you want to stop this this as well, use <a href="qhttp.html#abort">abort</a>().</p>
 
209
<p>See also <a href="qhttp.html#hasPendingRequests">hasPendingRequests</a>() and <a href="qhttp.html#abort">abort</a>().</p>
 
210
<h3 class="fn"><a name="close"></a>int QHttp::close ()</h3>
 
211
<p>Closes the connection; this is useful if you have a keep-alive connection and want to close it.</p>
 
212
<p>For the requests issued with <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>() and <a href="qhttp.html#head">head</a>(), <a href="qhttp.html">QHttp</a> sets the connection to be keep-alive. You can also do this using the header you pass to the <a href="qhttp.html#request">request</a>() function. <a href="qhttp.html">QHttp</a> only closes the connection to the HTTP server if the response header requires it to do so.</p>
 
213
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
214
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
215
<p>If you want to close the connection immediately, you have to use <a href="qhttp.html#abort">abort</a>() instead.</p>
 
216
<p>See also <a href="qhttp.html#stateChanged">stateChanged</a>(), <a href="qhttp.html#abort">abort</a>(), <a href="qhttp.html#requestStarted">requestStarted</a>(), <a href="qhttp.html#requestFinished">requestFinished</a>(), and <a href="qhttp.html#done">done</a>().</p>
 
217
<h3 class="fn"><a name="currentDestinationDevice"></a><a href="qiodevice.html">QIODevice</a> * QHttp::currentDestinationDevice () const</h3>
 
218
<p>Returns the <a href="qiodevice.html">QIODevice</a> pointer that is used as to store the data of the HTTP request being executed. If there is no current request or if the request does not store the data to an IO device, this function returns 0.</p>
 
219
<p>This function can be used to delete the <a href="qiodevice.html">QIODevice</a> in the slot connected to the <a href="qhttp.html#requestFinished">requestFinished</a>() signal.</p>
 
220
<p>See also <a href="qhttp.html#currentSourceDevice">currentSourceDevice</a>(), <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), and <a href="qhttp.html#request">request</a>().</p>
 
221
<h3 class="fn"><a name="currentId"></a>int QHttp::currentId () const</h3>
 
222
<p>Returns the identifier of the HTTP request being executed or 0 if there is no request being executed (i.e. they've all finished).</p>
 
223
<p>See also <a href="qhttp.html#currentRequest">currentRequest</a>().</p>
 
224
<h3 class="fn"><a name="currentRequest"></a><a href="qhttprequestheader.html">QHttpRequestHeader</a> QHttp::currentRequest () const</h3>
 
225
<p>Returns the request header of the HTTP request being executed. If the request is one issued by <a href="qhttp.html#setHost">setHost</a>() or <a href="qhttp.html#close">close</a>(), it returns an invalid request header, i.e. <a href="qhttpheader.html#isValid">QHttpRequestHeader::isValid</a>() returns false.</p>
 
226
<p>See also <a href="qhttp.html#currentId">currentId</a>().</p>
 
227
<h3 class="fn"><a name="currentSourceDevice"></a><a href="qiodevice.html">QIODevice</a> * QHttp::currentSourceDevice () const</h3>
 
228
<p>Returns the <a href="qiodevice.html">QIODevice</a> pointer that is used as the data source of the HTTP request being executed. If there is no current request or if the request does not use an IO device as the data source, this function returns 0.</p>
 
229
<p>This function can be used to delete the <a href="qiodevice.html">QIODevice</a> in the slot connected to the <a href="qhttp.html#requestFinished">requestFinished</a>() signal.</p>
 
230
<p>See also <a href="qhttp.html#currentDestinationDevice">currentDestinationDevice</a>(), <a href="qhttp.html#post">post</a>(), and <a href="qhttp.html#request">request</a>().</p>
 
231
<h3 class="fn"><a name="dataReadProgress"></a>void QHttp::dataReadProgress ( int <i>done</i>, int <i>total</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
232
<p>This signal is emitted when this object reads data from a HTTP server to indicate the current progress of the download.</p>
 
233
<p><i>done</i> is the amount of data that has already arrived and <i>total</i> is the total amount of data. It is possible that the total amount of data that should be transferred cannot be determined, in which case <i>total</i> is 0.(If you connect to a <a href="qprogressbar.html">QProgressBar</a>, the progress bar shows a busy indicator if the total is 0).</p>
 
234
<p><b>Warning:</b> <i>done</i> and <i>total</i> are not necessarily the size in bytes, since for large files these values might need to be &quot;scaled&quot; to avoid overflow.</p>
 
235
<p>See also <a href="qhttp.html#dataSendProgress">dataSendProgress</a>(), <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#request">request</a>(), and <a href="qprogressbar.html">QProgressBar</a>.</p>
 
236
<h3 class="fn"><a name="dataSendProgress"></a>void QHttp::dataSendProgress ( int <i>done</i>, int <i>total</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
237
<p>This signal is emitted when this object sends data to a HTTP server to inform it about the progress of the upload.</p>
 
238
<p><i>done</i> is the amount of data that has already arrived and <i>total</i> is the total amount of data. It is possible that the total amount of data that should be transferred cannot be determined, in which case <i>total</i> is 0.(If you connect to a <a href="qprogressbar.html">QProgressBar</a>, the progress bar shows a busy indicator if the total is 0).</p>
 
239
<p><b>Warning:</b> <i>done</i> and <i>total</i> are not necessarily the size in bytes, since for large files these values might need to be &quot;scaled&quot; to avoid overflow.</p>
 
240
<p>See also <a href="qhttp.html#dataReadProgress">dataReadProgress</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#request">request</a>(), and <a href="qprogressbar.html">QProgressBar</a>.</p>
 
241
<h3 class="fn"><a name="done"></a>void QHttp::done ( bool <i>error</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
242
<p>This signal is emitted when the last pending request has finished; (it is emitted after the last request's <a href="qhttp.html#requestFinished">requestFinished</a>() signal). <i>error</i> is true if an error occurred during the processing; otherwise <i>error</i> is false.</p>
 
243
<p>See also <a href="qhttp.html#requestFinished">requestFinished</a>(), <a href="qhttp.html#error">error</a>(), and <a href="qhttp.html#errorString">errorString</a>().</p>
 
244
<h3 class="fn"><a name="error"></a><a href="qhttp.html#Error-enum">Error</a> QHttp::error () const</h3>
 
245
<p>Returns the last error that occurred. This is useful to find out what happened when receiving a <a href="qhttp.html#requestFinished">requestFinished</a>() or a <a href="qhttp.html#done">done</a>() signal with the <tt>error</tt> argument <tt>true</tt>.</p>
 
246
<p>If you start a new request, the error status is reset to <tt>NoError</tt>.</p>
 
247
<h3 class="fn"><a name="errorString"></a><a href="qstring.html">QString</a> QHttp::errorString () const</h3>
 
248
<p>Returns a human-readable description of the last error that occurred. This is useful to present a error message to the user when receiving a <a href="qhttp.html#requestFinished">requestFinished</a>() or a <a href="qhttp.html#done">done</a>() signal with the <tt>error</tt> argument <tt>true</tt>.</p>
 
249
<h3 class="fn"><a name="get"></a>int QHttp::get ( const <a href="qstring.html">QString</a> &amp; <i>path</i>, <a href="qiodevice.html">QIODevice</a> * <i>to</i> = 0 )</h3>
 
250
<p>Sends a get request for <i>path</i> to the server set by <a href="qhttp.html#setHost">setHost</a>() or as specified in the constructor.</p>
 
251
<p><i>path</i> must be an absolute path like <tt>/index.html</tt> or an absolute URI like <tt>http://www.trolltech.com/index.html</tt>.</p>
 
252
<p>If the IO device <i>to</i> is 0 the <a href="qhttp.html#readyRead">readyRead</a>() signal is emitted every time new content data is available to read.</p>
 
253
<p>If the IO device <i>to</i> is not 0, the content data of the response is written directly to the device. Make sure that the <i>to</i> pointer is valid for the duration of the operation (it is safe to delete it when the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted).</p>
 
254
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
255
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
256
<p>See also <a href="qhttp.html#setHost">setHost</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#head">head</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#requestStarted">requestStarted</a>(), <a href="qhttp.html#requestFinished">requestFinished</a>(), and <a href="qhttp.html#done">done</a>().</p>
 
257
<h3 class="fn"><a name="hasPendingRequests"></a>bool QHttp::hasPendingRequests () const</h3>
 
258
<p>Returns true if there are any requests scheduled that have not yet been executed; otherwise returns false.</p>
 
259
<p>The request that is being executed is <i>not</i> considered as a scheduled request.</p>
 
260
<p>See also <a href="qhttp.html#clearPendingRequests">clearPendingRequests</a>(), <a href="qhttp.html#currentId">currentId</a>(), and <a href="qhttp.html#currentRequest">currentRequest</a>().</p>
 
261
<h3 class="fn"><a name="head"></a>int QHttp::head ( const <a href="qstring.html">QString</a> &amp; <i>path</i> )</h3>
 
262
<p>Sends a header request for <i>path</i> to the server set by <a href="qhttp.html#setHost">setHost</a>() or as specified in the constructor.</p>
 
263
<p><i>path</i> must be an absolute path like <tt>/index.html</tt> or an absolute URI like <tt>http://www.trolltech.com/index.html</tt>.</p>
 
264
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
265
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
266
<p>See also <a href="qhttp.html#setHost">setHost</a>(), <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#requestStarted">requestStarted</a>(), <a href="qhttp.html#requestFinished">requestFinished</a>(), and <a href="qhttp.html#done">done</a>().</p>
 
267
<h3 class="fn"><a name="lastResponse"></a><a href="qhttpresponseheader.html">QHttpResponseHeader</a> QHttp::lastResponse () const</h3>
 
268
<p>Returns the received response header of the most recently finished HTTP request. If no response has yet been received <a href="qhttpheader.html#isValid">QHttpResponseHeader::isValid</a>() will return false.</p>
 
269
<p>See also <a href="qhttp.html#currentRequest">currentRequest</a>().</p>
 
270
<h3 class="fn"><a name="post"></a>int QHttp::post ( const <a href="qstring.html">QString</a> &amp; <i>path</i>, <a href="qiodevice.html">QIODevice</a> * <i>data</i>, <a href="qiodevice.html">QIODevice</a> * <i>to</i> = 0 )</h3>
 
271
<p>Sends a post request for <i>path</i> to the server set by <a href="qhttp.html#setHost">setHost</a>() or as specified in the constructor.</p>
 
272
<p><i>path</i> must be an absolute path like <tt>/index.html</tt> or an absolute URI like <tt>http://www.trolltech.com/index.html</tt>.</p>
 
273
<p>The incoming data comes via the <i>data</i> IO device.</p>
 
274
<p>If the IO device <i>to</i> is 0 the <a href="qhttp.html#readyRead">readyRead</a>() signal is emitted every time new content data is available to read.</p>
 
275
<p>If the IO device <i>to</i> is not 0, the content data of the response is written directly to the device. Make sure that the <i>to</i> pointer is valid for the duration of the operation (it is safe to delete it when the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted).</p>
 
276
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
277
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
278
<p>See also <a href="qhttp.html#setHost">setHost</a>(), <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#head">head</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#requestStarted">requestStarted</a>(), <a href="qhttp.html#requestFinished">requestFinished</a>(), and <a href="qhttp.html#done">done</a>().</p>
 
279
<h3 class="fn"><a name="post-2"></a>int QHttp::post ( const <a href="qstring.html">QString</a> &amp; <i>path</i>, const <a href="qbytearray.html">QByteArray</a> &amp; <i>data</i>, <a href="qiodevice.html">QIODevice</a> * <i>to</i> = 0 )</h3>
 
280
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
281
<p><i>data</i> is used as the content data of the HTTP request.</p>
 
282
<h3 class="fn"><a name="read"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QHttp::read ( char * <i>data</i>, <a href="qtglobal.html#qint64-typedef">qint64</a> <i>maxlen</i> )</h3>
 
283
<p>Reads <i>maxlen</i> bytes from the response content into <i>data</i> and returns the number of bytes read. Returns -1 if an error occurred.</p>
 
284
<p>See also <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#readyRead">readyRead</a>(), <a href="qhttp.html#bytesAvailable">bytesAvailable</a>(), and <a href="qhttp.html#readAll">readAll</a>().</p>
 
285
<h3 class="fn"><a name="readAll"></a><a href="qbytearray.html">QByteArray</a> QHttp::readAll ()</h3>
 
286
<p>Reads all the bytes from the response content and returns them.</p>
 
287
<p>See also <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#readyRead">readyRead</a>(), <a href="qhttp.html#bytesAvailable">bytesAvailable</a>(), and <a href="qhttp.html#read">read</a>().</p>
 
288
<h3 class="fn"><a name="readyRead"></a>void QHttp::readyRead ( const <a href="qhttpresponseheader.html">QHttpResponseHeader</a> &amp; <i>resp</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
289
<p>This signal is emitted when there is new response data to read.</p>
 
290
<p>If you specified a device in the request where the data should be written to, then this signal is <i>not</i> emitted; instead the data is written directly to the device.</p>
 
291
<p>The response header is passed in <i>resp</i>.</p>
 
292
<p>You can read the data with the <a href="qhttp.html#readAll">readAll</a>() or <a href="qhttp.html#read">read</a>() functions</p>
 
293
<p>This signal is useful if you want to process the data in chunks as soon as it becomes available. If you are only interested in the complete data, just connect to the <a href="qhttp.html#requestFinished">requestFinished</a>() signal and read the data then instead.</p>
 
294
<p>See also <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#readAll">readAll</a>(), <a href="qhttp.html#read">read</a>(), and <a href="qhttp.html#bytesAvailable">bytesAvailable</a>().</p>
 
295
<h3 class="fn"><a name="request"></a>int QHttp::request ( const <a href="qhttprequestheader.html">QHttpRequestHeader</a> &amp; <i>header</i>, <a href="qiodevice.html">QIODevice</a> * <i>data</i> = 0, <a href="qiodevice.html">QIODevice</a> * <i>to</i> = 0 )</h3>
 
296
<p>Sends a request to the server set by <a href="qhttp.html#setHost">setHost</a>() or as specified in the constructor. Uses the <i>header</i> as the HTTP request header. You are responsible for setting up a header that is appropriate for your request.</p>
 
297
<p>The incoming data comes via the <i>data</i> IO device.</p>
 
298
<p>If the IO device <i>to</i> is 0 the <a href="qhttp.html#readyRead">readyRead</a>() signal is emitted every time new content data is available to read.</p>
 
299
<p>If the IO device <i>to</i> is not 0, the content data of the response is written directly to the device. Make sure that the <i>to</i> pointer is valid for the duration of the operation (it is safe to delete it when the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted).</p>
 
300
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
301
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
302
<p>See also <a href="qhttp.html#setHost">setHost</a>(), <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#head">head</a>(), <a href="qhttp.html#requestStarted">requestStarted</a>(), <a href="qhttp.html#requestFinished">requestFinished</a>(), and <a href="qhttp.html#done">done</a>().</p>
 
303
<h3 class="fn"><a name="request-2"></a>int QHttp::request ( const <a href="qhttprequestheader.html">QHttpRequestHeader</a> &amp; <i>header</i>, const <a href="qbytearray.html">QByteArray</a> &amp; <i>data</i>, <a href="qiodevice.html">QIODevice</a> * <i>to</i> = 0 )</h3>
 
304
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
305
<p><i>data</i> is used as the content data of the HTTP request.</p>
 
306
<h3 class="fn"><a name="requestFinished"></a>void QHttp::requestFinished ( int <i>id</i>, bool <i>error</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
307
<p>This signal is emitted when processing the request identified by <i>id</i> has finished. <i>error</i> is true if an error occurred during the processing; otherwise <i>error</i> is false.</p>
 
308
<p>See also <a href="qhttp.html#requestStarted">requestStarted</a>(), <a href="qhttp.html#done">done</a>(), <a href="qhttp.html#error">error</a>(), and <a href="qhttp.html#errorString">errorString</a>().</p>
 
309
<h3 class="fn"><a name="requestStarted"></a>void QHttp::requestStarted ( int <i>id</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
310
<p>This signal is emitted when processing the request identified by <i>id</i> starts.</p>
 
311
<p>See also <a href="qhttp.html#requestFinished">requestFinished</a>() and <a href="qhttp.html#done">done</a>().</p>
 
312
<h3 class="fn"><a name="responseHeaderReceived"></a>void QHttp::responseHeaderReceived ( const <a href="qhttpresponseheader.html">QHttpResponseHeader</a> &amp; <i>resp</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
313
<p>This signal is emitted when the HTTP header of a server response is available. The header is passed in <i>resp</i>.</p>
 
314
<p>See also <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#head">head</a>(), <a href="qhttp.html#request">request</a>(), and <a href="qhttp.html#readyRead">readyRead</a>().</p>
 
315
<h3 class="fn"><a name="setHost"></a>int QHttp::setHost ( const <a href="qstring.html">QString</a> &amp; <i>hostName</i>, <a href="qtglobal.html#quint16-typedef">quint16</a> <i>port</i> = 80 )</h3>
 
316
<p>Sets the HTTP server that is used for requests to <i>hostName</i> on port <i>port</i>.</p>
 
317
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
318
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
319
<p>See also <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#head">head</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#requestStarted">requestStarted</a>(), <a href="qhttp.html#requestFinished">requestFinished</a>(), and <a href="qhttp.html#done">done</a>().</p>
 
320
<h3 class="fn"><a name="setProxy"></a>int QHttp::setProxy ( const <a href="qstring.html">QString</a> &amp; <i>host</i>, int <i>port</i>, const <a href="qstring.html">QString</a> &amp; <i>username</i> = QString(), const <a href="qstring.html">QString</a> &amp; <i>password</i> = QString() )</h3>
 
321
<p>Enables proxy support, using the proxy server <i>host</i> on port <i>port</i>. <i>username</i> and <i>password</i> can be provided if the proxy server requires authentication.</p>
 
322
<h3 class="fn"><a name="setSocket"></a>int QHttp::setSocket ( <a href="qtcpsocket.html">QTcpSocket</a> * <i>socket</i> )</h3>
 
323
<p>Replaces the internal QSocket that <a href="qhttp.html">QHttp</a> uses with the given <i>socket</i>. This is useful if you want to use your own custom QSocket subclass instead of the plain QSocket that <a href="qhttp.html">QHttp</a> uses by default.</p>
 
324
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
325
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
326
<h3 class="fn"><a name="setUser"></a>int QHttp::setUser ( const <a href="qstring.html">QString</a> &amp; <i>userName</i>, const <a href="qstring.html">QString</a> &amp; <i>password</i> = QString() )</h3>
 
327
<p>This function sets the user name <i>userName</i> and password <i>password</i> for web pages that require authentication.</p>
 
328
<p>The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qhttp.html#requestStarted">requestStarted</a>() and <a href="qhttp.html#requestFinished">requestFinished</a>().</p>
 
329
<p>When the request is started the <a href="qhttp.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="qhttp.html#requestFinished">requestFinished</a>() signal is emitted.</p>
 
330
<h3 class="fn"><a name="state"></a><a href="qhttp.html#State-enum">State</a> QHttp::state () const</h3>
 
331
<p>Returns the current state of the object. When the state changes, the <a href="qhttp.html#stateChanged">stateChanged</a>() signal is emitted.</p>
 
332
<p>See also <a href="qhttp.html#State-enum">State</a> and <a href="qhttp.html#stateChanged">stateChanged</a>().</p>
 
333
<h3 class="fn"><a name="stateChanged"></a>void QHttp::stateChanged ( int <i>state</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
334
<p>This signal is emitted when the state of the <a href="qhttp.html">QHttp</a> object changes. The argument <i>state</i> is the new state of the connection; it is one of the <a href="qhttp.html#State-enum">State</a> values.</p>
 
335
<p>This usually happens when a request is started, but it can also happen when the server closes the connection or when a call to <a href="qhttp.html#close">close</a>() succeeded.</p>
 
336
<p>See also <a href="qhttp.html#get">get</a>(), <a href="qhttp.html#post">post</a>(), <a href="qhttp.html#head">head</a>(), <a href="qhttp.html#request">request</a>(), <a href="qhttp.html#close">close</a>(), <a href="qhttp.html#state">state</a>(), and <a href="qhttp.html#State-enum">State</a>.</p>
 
337
<p /><address><hr /><div align="center">
 
338
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
339
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
340
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
341
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
342
</tr></table></div></address></body>
 
343
</html>