<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>TQHttp Class Reference<br><small>[<ahref="network.html">network module</a>]</small></h1>
<p>The TQHttp class provides an implementation of the HTTP protocol.
<p> You can then get details about the error with the <ahref="#error">error</a>() and
<ahref="#errorString">errorString</a>() functions. Note that only unexpected behaviour, 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 <ahref="qhttpresponseheader.html#statusCode">status code</a> of the
response header.
<p> The functions <ahref="#currentId">currentId</a>() and <ahref="#currentRequest">currentRequest</a>() provide more
information about the currently executing request.
<p> The functions <ahref="#hasPendingRequests">hasPendingRequests</a>() and <ahref="#clearPendingRequests">clearPendingRequests</a>()
allow you to query and clear the list of pending requests.
<p><p>See also <ahref="network.html">TQt Network Documentation</a>, <ahref="qnetworkprotocol.html">TQNetworkProtocol</a>, <ahref="qurloperator.html">TQUrlOperator</a>, <ahref="qftp.html">TQFtp</a>, and <ahref="io.html">Input/Output and Networking</a>.
Aborts the current request and deletes all scheduled requests.
<p> For the current request, the <ahref="#requestFinished">requestFinished</a>() signal with the <tt>error</tt> argument <tt>TRUE</tt> is emitted. For all other requests that are
affected by the <ahref="#abort">abort</a>(), no signals are emitted.
<p> Since this slot also deletes the scheduled requests, there are no
requests left and the <ahref="#done">done</a>() signal is emitted (with the <tt>error</tt>
argument <tt>TRUE</tt>).
<p><p>See also <ahref="#clearPendingRequests">clearPendingRequests</a>().
Returns the number of bytes that can be read from the response
content at the moment.
<p><p>See also <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#request">request</a>(), <ahref="#readyRead">readyRead</a>(), <ahref="#readBlock">readBlock</a>(), and <ahref="#readAll">readAll</a>().
<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
<ahref="#requestStarted">requestStarted</a>() and <ahref="#requestFinished">requestFinished</a>().
<p> When the request is started the requestStarted() signal is
emitted. When it is finished the requestFinished() signal is
emitted.
<p> If you want to close the connection immediately, you have to use
<ahref="#abort">abort</a>() instead.
<p><p>See also <ahref="#stateChanged">stateChanged</a>(), <ahref="#abort">abort</a>(), <ahref="#requestStarted">requestStarted</a>(), <ahref="#requestFinished">requestFinished</a>(), and <ahref="#done">done</a>().
<p> This signal is emitted when this object reads data from a HTTP
server to indicate the current progress of the download.
<p><em>done</em> is the amount of data that has already arrived and <em>total</em> 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 <em>total</em> is 0.(If you connect to a <ahref="qprogressbar.html">TQProgressBar</a>, the
progress bar shows a busy indicator if the total is 0).
<p><b>Warning:</b><em>done</em> and <em>total</em> are not necessarily the size in
bytes, since for large files these values might need to be
"scaled" to avoid overflow.
<p><p>See also <ahref="#dataSendProgress">dataSendProgress</a>(), <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#request">request</a>(), and <ahref="qprogressbar.html#progress-prop">TQProgressBar::progress</a>.
<p> This signal is emitted when this object sends data to a HTTP
server to inform it about the progress of the upload.
<p><em>done</em> is the amount of data that has already arrived and <em>total</em> 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 <em>total</em> is 0.(If you connect to a <ahref="qprogressbar.html">TQProgressBar</a>, the
progress bar shows a busy indicator if the total is 0).
<p><b>Warning:</b><em>done</em> and <em>total</em> are not necessarily the size in
bytes, since for large files these values might need to be
"scaled" to avoid overflow.
<p><p>See also <ahref="#dataReadProgress">dataReadProgress</a>(), <ahref="#post">post</a>(), <ahref="#request">request</a>(), and <ahref="qprogressbar.html#progress-prop">TQProgressBar::progress</a>.
Sends a get request for <em>path</em> to the server set by <ahref="#setHost">setHost</a>() or
as specified in the constructor.
<p><em>path</em> must be an absolute path like <tt>/index.html</tt> or an
absolute URI like <ahref="http://www.trolltech.com/index.html">http://www.trolltech.com/index.html</a>.
<p> If the IO device <em>to</em> is 0 the <ahref="#readyRead">readyRead</a>() signal is emitted
every time new content data is available to read.
<p> If the IO device <em>to</em> is not 0, the content data of the response
is written directly to the device. Make sure that the <em>to</em>
pointer is valid for the duration of the operation (it is safe to
delete it when the <ahref="#requestFinished">requestFinished</a>() signal is emitted).
<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
<ahref="#requestStarted">requestStarted</a>() and requestFinished().
<p> When the request is started the requestStarted() signal is
emitted. When it is finished the requestFinished() signal is
emitted.
<p><p>See also <ahref="#setHost">setHost</a>(), <ahref="#post">post</a>(), <ahref="#head">head</a>(), <ahref="#request">request</a>(), <ahref="#requestStarted">requestStarted</a>(), <ahref="#requestFinished">requestFinished</a>(), and <ahref="#done">done</a>().
Returns TRUE if there are any requests scheduled that have not yet
been executed; otherwise returns FALSE.
<p> The request that is being executed is <em>not</em> considered as a
scheduled request.
<p><p>See also <ahref="#clearPendingRequests">clearPendingRequests</a>(), <ahref="#currentId">currentId</a>(), and <ahref="#currentRequest">currentRequest</a>().
Sends a header request for <em>path</em> to the server set by <ahref="#setHost">setHost</a>()
or as specified in the constructor.
<p><em>path</em> must be an absolute path like <tt>/index.html</tt> or an
absolute URI like <ahref="http://www.trolltech.com/index.html">http://www.trolltech.com/index.html</a>.
<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
<ahref="#requestStarted">requestStarted</a>() and <ahref="#requestFinished">requestFinished</a>().
<p> When the request is started the requestStarted() signal is
emitted. When it is finished the requestFinished() signal is
emitted.
<p><p>See also <ahref="#setHost">setHost</a>(), <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#request">request</a>(), <ahref="#requestStarted">requestStarted</a>(), <ahref="#requestFinished">requestFinished</a>(), and <ahref="#done">done</a>().
Sends a post request for <em>path</em> to the server set by <ahref="#setHost">setHost</a>() or
as specified in the constructor.
<p><em>path</em> must be an absolute path like <tt>/index.html</tt> or an
absolute URI like <ahref="http://www.trolltech.com/index.html">http://www.trolltech.com/index.html</a>.
<p> The incoming data comes via the <em>data</em> IO device.
<p> If the IO device <em>to</em> is 0 the <ahref="#readyRead">readyRead</a>() signal is emitted
every time new content data is available to read.
<p> If the IO device <em>to</em> is not 0, the content data of the response
is written directly to the device. Make sure that the <em>to</em>
pointer is valid for the duration of the operation (it is safe to
delete it when the <ahref="#requestFinished">requestFinished</a>() signal is emitted).
<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
<ahref="#requestStarted">requestStarted</a>() and requestFinished().
<p> When the request is started the requestStarted() signal is
emitted. When it is finished the requestFinished() signal is
emitted.
<p><p>See also <ahref="#setHost">setHost</a>(), <ahref="#get">get</a>(), <ahref="#head">head</a>(), <ahref="#request">request</a>(), <ahref="#requestStarted">requestStarted</a>(), <ahref="#requestFinished">requestFinished</a>(), and <ahref="#done">done</a>().
Reads all the bytes from the response content and returns them.
<p><p>See also <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#request">request</a>(), <ahref="#readyRead">readyRead</a>(), <ahref="#bytesAvailable">bytesAvailable</a>(), and <ahref="#readBlock">readBlock</a>().
Reads <em>maxlen</em> bytes from the response content into <em>data</em> and
returns the number of bytes read. Returns -1 if an error occurred.
<p><p>See also <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#request">request</a>(), <ahref="#readyRead">readyRead</a>(), <ahref="#bytesAvailable">bytesAvailable</a>(), and <ahref="#readAll">readAll</a>().
<p> This signal is emitted when there is new response data to read.
<p> If you specified a device in the request where the data should be
written to, then this signal is <em>not</em> emitted; instead the data
is written directly to the device.
<p> The response header is passed in <em>resp</em>.
<p> You can read the data with the <ahref="#readAll">readAll</a>() or <ahref="#readBlock">readBlock</a>() functions
<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 <ahref="#requestFinished">requestFinished</a>() signal and
read the data then instead.
<p><p>See also <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#request">request</a>(), <ahref="#readAll">readAll</a>(), <ahref="#readBlock">readBlock</a>(), and <ahref="#bytesAvailable">bytesAvailable</a>().
Sends a request to the server set by <ahref="#setHost">setHost</a>() or as specified in
the constructor. Uses the <em>header</em> as the HTTP request header.
You are responsible for setting up a header that is appropriate
for your request.
<p> The incoming data comes via the <em>data</em> IO device.
<p> If the IO device <em>to</em> is 0 the <ahref="#readyRead">readyRead</a>() signal is emitted
every time new content data is available to read.
<p> If the IO device <em>to</em> is not 0, the content data of the response
is written directly to the device. Make sure that the <em>to</em>
pointer is valid for the duration of the operation (it is safe to
delete it when the <ahref="#requestFinished">requestFinished</a>() signal is emitted).
<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
<ahref="#requestStarted">requestStarted</a>() and requestFinished().
<p> When the request is started the requestStarted() signal is
emitted. When it is finished the requestFinished() signal is
emitted.
<p><p>See also <ahref="#setHost">setHost</a>(), <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#head">head</a>(), <ahref="#requestStarted">requestStarted</a>(), <ahref="#requestFinished">requestFinished</a>(), and <ahref="#done">done</a>().
<p> This signal is emitted when processing the request identified by
<em>id</em> has finished. <em>error</em> is TRUE if an error occurred during
the processing; otherwise <em>error</em> is FALSE.
<p><p>See also <ahref="#requestStarted">requestStarted</a>(), <ahref="#done">done</a>(), <ahref="#error">error</a>(), and <ahref="#errorString">errorString</a>().
<p> This signal is emitted when the HTTP header of a server response
is available. The header is passed in <em>resp</em>.
<p><p>See also <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#head">head</a>(), <ahref="#request">request</a>(), and <ahref="#readyRead">readyRead</a>().
Sets the HTTP server that is used for requests to <em>hostname</em> on
port <em>port</em>.
<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
<ahref="#requestStarted">requestStarted</a>() and <ahref="#requestFinished">requestFinished</a>().
<p> When the request is started the requestStarted() signal is
emitted. When it is finished the requestFinished() signal is
emitted.
<p><p>See also <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#head">head</a>(), <ahref="#request">request</a>(), <ahref="#requestStarted">requestStarted</a>(), <ahref="#requestFinished">requestFinished</a>(), and <ahref="#done">done</a>().
<p><p>See also <ahref="#get">get</a>(), <ahref="#post">post</a>(), <ahref="#head">head</a>(), <ahref="#request">request</a>(), <ahref="#closeConnection">closeConnection</a>(), <ahref="#state">state</a>(), and <ahref="#State-enum">State</a>.
<!-- eof -->
<hr><p>
This file is part of the <ahref="index.html">TQt toolkit</a>.