Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 4560

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- q3http.cpp -->
  <title>Qt 4.8: Q3Http Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qt3support.html">Qt3Support</a></li>
<li>Q3Http</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3Http Class Reference</h1>
<!-- $$$Q3Http-brief -->
<p>The Q3Http class provides an implementation of the HTTP protocol. <a href="#details">More...</a></p>
<!-- @@@Q3Http -->
<pre class="cpp"> <span class="preprocessor">#include &lt;Q3Http&gt;</span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qhttp">Porting to Qt 4</a> for more information.</p>
<p><b>Inherits: </b><a href="q3networkprotocol.html">Q3NetworkProtocol</a>.</p>
<ul>
<li><a href="q3http-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#Error-enum">Error</a></b> { NoError, HostNotFound, ConnectionRefused, UnexpectedClose, ..., UnknownError }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#State-enum">State</a></b> { Unconnected, HostLookup, Connecting, Sending, ..., Closing }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#Q3Http">Q3Http</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#Q3Http-2">Q3Http</a></b> ( QObject * <i>parent</i>, const char * <i>name</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#Q3Http-3">Q3Http</a></b> ( const QString &amp; <i>hostname</i>, Q_UINT16 <i>port</i> = 80, QObject * <i>parent</i> = 0, const char * <i>name</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#dtor.Q3Http">~Q3Http</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q_ULONG </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#bytesAvailable">bytesAvailable</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#clearPendingRequests">clearPendingRequests</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#closeConnection">closeConnection</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIODevice * </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#currentDestinationDevice">currentDestinationDevice</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#currentId">currentId</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3HttpRequestHeader </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#currentRequest">currentRequest</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIODevice * </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#currentSourceDevice">currentSourceDevice</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Error </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#error">error</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#errorString">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#get">get</a></b> ( const QString &amp; <i>path</i>, QIODevice * <i>to</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#hasPendingRequests">hasPendingRequests</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#head">head</a></b> ( const QString &amp; <i>path</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#post">post</a></b> ( const QString &amp; <i>path</i>, QIODevice * <i>data</i>, QIODevice * <i>to</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#post-2">post</a></b> ( const QString &amp; <i>path</i>, const QByteArray &amp; <i>data</i>, QIODevice * <i>to</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#readAll">readAll</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q_LONG </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#readBlock">readBlock</a></b> ( char * <i>data</i>, Q_ULONG <i>maxlen</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#request">request</a></b> ( const Q3HttpRequestHeader &amp; <i>header</i>, QIODevice * <i>data</i> = 0, QIODevice * <i>to</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#request-2">request</a></b> ( const Q3HttpRequestHeader &amp; <i>header</i>, const QByteArray &amp; <i>data</i>, QIODevice * <i>to</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#setHost">setHost</a></b> ( const QString &amp; <i>hostname</i>, Q_UINT16 <i>port</i> = 80 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> State </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#state">state</a></b> () const</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#supportedOperations">supportedOperations</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">9 public functions inherited from <a href="q3networkprotocol.html#public-functions">Q3NetworkProtocol</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#abort">abort</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#dataReadProgress">dataReadProgress</a></b> ( int <i>done</i>, int <i>total</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#dataSendProgress">dataSendProgress</a></b> ( int <i>done</i>, int <i>total</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#done">done</a></b> ( bool <i>error</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#readyRead">readyRead</a></b> ( const Q3HttpResponseHeader &amp; <i>resp</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#requestFinished">requestFinished</a></b> ( int <i>id</i>, bool <i>error</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#requestStarted">requestStarted</a></b> ( int <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#responseHeaderReceived">responseHeaderReceived</a></b> ( const Q3HttpResponseHeader &amp; <i>resp</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#stateChanged">stateChanged</a></b> ( int <i>state</i> )</td></tr>
</table>
<ul>
<li class="fn">10 signals inherited from <a href="q3networkprotocol.html#signals">Q3NetworkProtocol</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#operationGet">operationGet</a></b> ( Q3NetworkOperation * <i>op</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#operationPut">operationPut</a></b> ( Q3NetworkOperation * <i>op</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3http.html#timerEvent">timerEvent</a></b> ( QTimerEvent * <i>e</i> )</td></tr>
</table>
<ul>
<li class="fn">7 protected functions inherited from <a href="q3networkprotocol.html#protected-functions">Q3NetworkProtocol</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">3 static public members inherited from <a href="q3networkprotocol.html#static-public-members">Q3NetworkProtocol</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">7 protected functions inherited from <a href="q3networkprotocol.html#protected-functions">Q3NetworkProtocol</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$Q3Http-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3Http class provides an implementation of the HTTP protocol.</p>
<p>This class provides two different interfaces: one is the <a href="q3networkprotocol.html">Q3NetworkProtocol</a> interface that allows you to use HTTP through the <a href="porting4.html#qurloperator">QUrlOperator</a> abstraction. The other is 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>
<p>Don't mix the two interfaces, since the behavior is not well-defined.</p>
<p>If you want to use Q3Http with the <a href="q3networkprotocol.html">Q3NetworkProtocol</a> interface, you do not use it directly, but rather through a <a href="porting4.html#qurloperator">QUrlOperator</a>, for example:</p>
<pre class="cpp"> <span class="type">QUrlOperator</span> op( <span class="string">&quot;http://qt.nokia.com&quot;</span> );
 op<span class="operator">.</span><a href="q3http.html#get">get</a>( <span class="string">&quot;index.html&quot;</span> );</pre>
<p>This code will only work if the Q3Http class is registered; to register the class, you must call <a href="q3urloperator.html#q3InitNetworkProtocols">q3InitNetworkProtocols</a>() before using a <a href="porting4.html#qurloperator">QUrlOperator</a> with HTTP.</p>
<p>The <a href="q3networkprotocol.html">Q3NetworkProtocol</a> interface for HTTP only supports the operations <a href="q3http.html#operationGet">operationGet</a>() and <a href="q3http.html#operationPut">operationPut</a>(), i.e&#x2e; QUrlOperator::get() and QUrlOperator::put(), if you use it with a <a href="porting4.html#qurloperator">QUrlOperator</a>.</p>
<p>The rest of this descrption describes the direct interface to HTTP.</p>
<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>
<p>The operations that can be scheduled (they are called &quot;requests&quot; in the rest of the documentation) are the following: <a href="q3http.html#setHost">setHost</a>(), <a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#head">head</a>() and <a href="q3http.html#request">request</a>().</p>
<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="q3http.html#requestStarted">requestStarted</a>() signal with the identifier is emitted and when the request is finished, the <a href="q3http.html#requestFinished">requestFinished</a>() signal is emitted with the identifier and a bool that indicates if the request finished with an error.</p>
<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 Qt website (i.e&#x2e; the URL <tt>http://qt.nokia.com/index.html</tt>):</p>
<pre class="cpp"> <span class="type"><a href="q3httprequestheader.html">Q3HttpRequestHeader</a></span> header( <span class="string">&quot;GET&quot;</span><span class="operator">,</span> <span class="string">&quot;/index.html&quot;</span> );
 header<span class="operator">.</span>setValue( <span class="string">&quot;Host&quot;</span><span class="operator">,</span> <span class="string">&quot;qt.nokia.com&quot;</span> );
 http<span class="operator">-</span><span class="operator">&gt;</span><a href="q3http.html#setHost">setHost</a>( <span class="string">&quot;qt.nokia.com&quot;</span> );
 http<span class="operator">-</span><span class="operator">&gt;</span><a href="q3http.html#request">request</a>( header );</pre>
<p>For the common HTTP requests <tt>GET</tt>, <tt>POST</tt> and <tt>HEAD</tt>, Q3Http provides the convenience functions <a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>() and <a href="q3http.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>
<pre class="cpp"> http<span class="operator">-</span><span class="operator">&gt;</span><a href="q3http.html#setHost">setHost</a>( <span class="string">&quot;qt.nokia.com&quot;</span> ); <span class="comment">// id == 1</span>
 http<span class="operator">-</span><span class="operator">&gt;</span><a href="q3http.html#get">get</a>( <span class="string">&quot;/index.html&quot;</span> );           <span class="comment">// id == 2</span></pre>
<p>For this example the following sequence of signals is emitted (with small variations, depending on network traffic, etc.):</p>
<pre class="cpp"> <a href="q3http.html#requestStarted">requestStarted</a>( <span class="number">1</span> )
 <a href="q3http.html#requestFinished">requestFinished</a>( <span class="number">1</span><span class="operator">,</span> <span class="keyword">false</span> )

 <a href="q3http.html#requestStarted">requestStarted</a>( <span class="number">2</span> )
 <a href="q3http.html#stateChanged">stateChanged</a>( Connecting )
 <a href="q3http.html#stateChanged">stateChanged</a>( Sending )
 <a href="q3http.html#dataSendProgress">dataSendProgress</a>( <span class="number">77</span><span class="operator">,</span> <span class="number">77</span> )
 <a href="q3http.html#stateChanged">stateChanged</a>( Reading )
 <a href="q3http.html#responseHeaderReceived">responseHeaderReceived</a>( responseheader )
 <a href="q3http.html#dataReadProgress">dataReadProgress</a>( <span class="number">5388</span><span class="operator">,</span> <span class="number">0</span> )
 <a href="q3http.html#readyRead">readyRead</a>( responseheader )
 <a href="q3http.html#dataReadProgress">dataReadProgress</a>( <span class="number">18300</span><span class="operator">,</span> <span class="number">0</span> )
 <a href="q3http.html#readyRead">readyRead</a>( responseheader )
 <a href="q3http.html#stateChanged">stateChanged</a>( Connected )
 <a href="q3http.html#requestFinished">requestFinished</a>( <span class="number">2</span><span class="operator">,</span> <span class="keyword">false</span> )

 <a href="q3http.html#done">done</a>( <span class="keyword">false</span> )

 <a href="q3http.html#stateChanged">stateChanged</a>( Closing )
 <a href="q3http.html#stateChanged">stateChanged</a>( Unconnected )</pre>
<p>The <a href="q3http.html#dataSendProgress">dataSendProgress</a>() and <a href="q3http.html#dataReadProgress">dataReadProgress</a>() signals in the above example are useful if you want to show a <a href="qprogressbar.html">progress bar</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>
<p>When the response header is read, it is reported with the <a href="q3http.html#responseHeaderReceived">responseHeaderReceived</a>() signal.</p>
<p>The <a href="q3http.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="q3http.html#bytesAvailable">bytesAvailable</a>() function and it can be read with the <a href="q3http.html#readBlock">readBlock</a>() or <a href="q3http.html#readAll">readAll</a>() functions.</p>
<p>If an error occurs during the execution of one of the commands in a sequence of commands, all the pending commands (i.e&#x2e; scheduled, but not yet executed commands) are cleared and no signals are emitted for them.</p>
<p>For example, if you have the following sequence of reqeusts</p>
<pre class="cpp"> http<span class="operator">-</span><span class="operator">&gt;</span><a href="q3http.html#setHost">setHost</a>( <span class="string">&quot;www.foo.bar&quot;</span> );       <span class="comment">// id == 1</span>
 http<span class="operator">-</span><span class="operator">&gt;</span><a href="q3http.html#get">get</a>( <span class="string">&quot;/index.html&quot;</span> );           <span class="comment">// id == 2</span>
 http<span class="operator">-</span><span class="operator">&gt;</span><a href="q3http.html#post">post</a>( <span class="string">&quot;register.html&quot;</span><span class="operator">,</span> data );  <span class="comment">// id == 3</span></pre>
<p>and the <a href="q3http.html#get">get</a>() request fails because the host lookup fails, then the <a href="q3http.html#post">post</a>() request is never executed and the signals would look like this:</p>
<pre class="cpp"> <a href="q3http.html#requestStarted">requestStarted</a>( <span class="number">1</span> )
 <a href="q3http.html#requestFinished">requestFinished</a>( <span class="number">1</span><span class="operator">,</span> <span class="keyword">false</span> )

 <a href="q3http.html#requestStarted">requestStarted</a>( <span class="number">2</span> )
 <a href="q3http.html#stateChanged">stateChanged</a>( HostLookup )
 <a href="q3http.html#requestFinished">requestFinished</a>( <span class="number">2</span><span class="operator">,</span> <span class="keyword">true</span> )

 <a href="q3http.html#done">done</a>( <span class="keyword">true</span> )

 <a href="q3http.html#stateChanged">stateChanged</a>( Unconnected )</pre>
<p>You can then get details about the error with the <a href="q3http.html#error">error</a>() and <a href="q3http.html#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 <a href="q3httpresponseheader.html#statusCode">status code</a> of the response header.</p>
<p>The functions <a href="q3http.html#currentId">currentId</a>() and <a href="q3http.html#currentRequest">currentRequest</a>() provide more information about the currently executing request.</p>
<p>The functions <a href="q3http.html#hasPendingRequests">hasPendingRequests</a>() and <a href="q3http.html#clearPendingRequests">clearPendingRequests</a>() allow you to query and clear the list of pending requests.</p>
</div>
<p><b>See also </b><a href="q3networkprotocol.html">Q3NetworkProtocol</a>, <a href="q3urloperator.html">Q3UrlOperator</a>, and <a href="q3ftp.html">Q3Ftp</a>.</p>
<!-- @@@Q3Http -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Error$$$NoError$$$UnknownError$$$HostNotFound$$$ConnectionRefused$$$UnexpectedClose$$$InvalidResponseHeader$$$WrongContentLength$$$Aborted -->
<h3 class="fn"><a name="Error-enum"></a>enum Q3Http::<span class="name">Error</span></h3>
<p>This enum identifies the error that occurred.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>Q3Http::NoError</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">No error occurred.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::HostNotFound</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">The host name lookup failed.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::ConnectionRefused</tt></td><td class="topAlign"><tt>3</tt></td><td class="topAlign">The server refused the connection.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::UnexpectedClose</tt></td><td class="topAlign"><tt>4</tt></td><td class="topAlign">The server closed the connection unexpectedly.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::InvalidResponseHeader</tt></td><td class="topAlign"><tt>5</tt></td><td class="topAlign">The server sent an invalid response header.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::WrongContentLength</tt></td><td class="topAlign"><tt>6</tt></td><td class="topAlign">The client could not read the content correctly because an error with respect to the content length occurred.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::Aborted</tt></td><td class="topAlign"><tt>7</tt></td><td class="topAlign">The request was aborted with <a href="q3http.html#abort">abort</a>().</td></tr>
<tr><td class="topAlign"><tt>Q3Http::UnknownError</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">An error other than those specified above occurred.</td></tr>
</table>
<p><b>See also </b><a href="q3http.html#error">error</a>().</p>
<!-- @@@Error -->
<!-- $$$State$$$Unconnected$$$HostLookup$$$Connecting$$$Sending$$$Reading$$$Connected$$$Closing -->
<h3 class="fn"><a name="State-enum"></a>enum Q3Http::<span class="name">State</span></h3>
<p>This enum is used to specify the state the client is in:</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>Q3Http::Unconnected</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">There is no connection to the host.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::HostLookup</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">A host name lookup is in progress.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::Connecting</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">An attempt to connect to the host is in progress.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::Sending</tt></td><td class="topAlign"><tt>3</tt></td><td class="topAlign">The client is sending its request to the server.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::Reading</tt></td><td class="topAlign"><tt>4</tt></td><td class="topAlign">The client's request has been sent and the client is reading the server's response.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::Connected</tt></td><td class="topAlign"><tt>5</tt></td><td class="topAlign">The connection to the host is open, but the client is neither sending a request, nor waiting for a response.</td></tr>
<tr><td class="topAlign"><tt>Q3Http::Closing</tt></td><td class="topAlign"><tt>6</tt></td><td class="topAlign">The connection is closing down, but is not yet closed. (The state will be <tt>Unconnected</tt> when the connection is closed.)</td></tr>
</table>
<p><b>See also </b><a href="q3http.html#stateChanged">stateChanged</a>() and <a href="q3http.html#state">state</a>().</p>
<!-- @@@State -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3Http[overload1]$$$Q3Http -->
<h3 class="fn"><a name="Q3Http"></a>Q3Http::<span class="name">Q3Http</span> ()</h3>
<p>Constructs a <a href="q3http.html" class="compat">Q3Http</a> object.</p>
<!-- @@@Q3Http -->
<!-- $$$Q3Http$$$Q3HttpQObject*constchar* -->
<h3 class="fn"><a name="Q3Http-2"></a>Q3Http::<span class="name">Q3Http</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i>, const <span class="type">char</span> * <i>name</i> = 0 )</h3>
<p>Constructs a <a href="q3http.html" class="compat">Q3Http</a> object. The parameters <i>parent</i> and <i>name</i> are passed on to the <a href="qobject.html">QObject</a> constructor.</p>
<!-- @@@Q3Http -->
<!-- $$$Q3Http$$$Q3HttpconstQString&Q_UINT16QObject*constchar* -->
<h3 class="fn"><a name="Q3Http-3"></a>Q3Http::<span class="name">Q3Http</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>hostname</i>, <span class="type"><a href="qtglobal-qt3.html#Q_UINT16-typedef">Q_UINT16</a></span> <i>port</i> = 80, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0, const <span class="type">char</span> * <i>name</i> = 0 )</h3>
<p>Constructs a <a href="q3http.html" class="compat">Q3Http</a> object. Subsequent requests are done by connecting to the server <i>hostname</i> on port <i>port</i>. The parameters <i>parent</i> and <i>name</i> are passed on to the <a href="qobject.html">QObject</a> constructor.</p>
<p><b>See also </b><a href="q3http.html#setHost">setHost</a>().</p>
<!-- @@@Q3Http -->
<!-- $$$~Q3Http[overload1]$$$~Q3Http -->
<h3 class="fn"><a name="dtor.Q3Http"></a>Q3Http::<span class="name">~Q3Http</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the <a href="q3http.html" class="compat">Q3Http</a> object. If there is an open connection, it is closed.</p>
<!-- @@@~Q3Http -->
<!-- $$$abort[overload1]$$$abort -->
<h3 class="fn"><a name="abort"></a><span class="type">void</span> Q3Http::<span class="name">abort</span> ()<tt> [slot]</tt></h3>
<p>Aborts the current request and deletes all scheduled requests.</p>
<p>For the current request, the <a href="q3http.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>
<p>Since this slot also deletes the scheduled requests, there are no requests left and the <a href="q3http.html#done">done</a>() signal is emitted (with the <tt>error</tt> argument <tt>true</tt>).</p>
<p><b>See also </b><a href="q3http.html#clearPendingRequests">clearPendingRequests</a>().</p>
<!-- @@@abort -->
<!-- $$$bytesAvailable[overload1]$$$bytesAvailable -->
<h3 class="fn"><a name="bytesAvailable"></a><span class="type"><a href="qtglobal-qt3.html#Q_ULONG-typedef">Q_ULONG</a></span> Q3Http::<span class="name">bytesAvailable</span> () const</h3>
<p>Returns the number of bytes that can be read from the response content at the moment.</p>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#readyRead">readyRead</a>(), <a href="q3http.html#readBlock">readBlock</a>(), and <a href="q3http.html#readAll">readAll</a>().</p>
<!-- @@@bytesAvailable -->
<!-- $$$clearPendingRequests[overload1]$$$clearPendingRequests -->
<h3 class="fn"><a name="clearPendingRequests"></a><span class="type">void</span> Q3Http::<span class="name">clearPendingRequests</span> ()</h3>
<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 as well, use <a href="q3http.html#abort">abort</a>().</p>
<p><b>See also </b><a href="q3http.html#hasPendingRequests">hasPendingRequests</a>() and <a href="q3http.html#abort">abort</a>().</p>
<!-- @@@clearPendingRequests -->
<!-- $$$closeConnection[overload1]$$$closeConnection -->
<h3 class="fn"><a name="closeConnection"></a><span class="type">int</span> Q3Http::<span class="name">closeConnection</span> ()</h3>
<p>Closes the connection; this is useful if you have a keep-alive connection and want to close it.</p>
<p>For the requests issued with <a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>() and <a href="q3http.html#head">head</a>(), <a href="q3http.html" class="compat">Q3Http</a> sets the connection to be keep-alive. You can also do this using the header you pass to the <a href="q3http.html#request">request</a>() function. <a href="q3http.html" class="compat">Q3Http</a> only closes the connection to the HTTP server if the response header requires it to do so.</p>
<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="q3http.html#requestStarted">requestStarted</a>() and <a href="q3http.html#requestFinished">requestFinished</a>().</p>
<p>When the request is started the <a href="q3http.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="q3http.html#requestFinished">requestFinished</a>() signal is emitted.</p>
<p>If you want to close the connection immediately, you have to use <a href="q3http.html#abort">abort</a>() instead.</p>
<p><b>See also </b><a href="q3http.html#stateChanged">stateChanged</a>(), <a href="q3http.html#abort">abort</a>(), <a href="q3http.html#requestStarted">requestStarted</a>(), <a href="q3http.html#requestFinished">requestFinished</a>(), and <a href="q3http.html#done">done</a>().</p>
<!-- @@@closeConnection -->
<!-- $$$currentDestinationDevice[overload1]$$$currentDestinationDevice -->
<h3 class="fn"><a name="currentDestinationDevice"></a><span class="type"><a href="qiodevice.html">QIODevice</a></span> * Q3Http::<span class="name">currentDestinationDevice</span> () const</h3>
<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>
<p>This function can be used to delete the <a href="qiodevice.html">QIODevice</a> in the slot connected to the <a href="q3http.html#requestFinished">requestFinished</a>() signal.</p>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), and <a href="q3http.html#request">request</a>().</p>
<!-- @@@currentDestinationDevice -->
<!-- $$$currentId[overload1]$$$currentId -->
<h3 class="fn"><a name="currentId"></a><span class="type">int</span> Q3Http::<span class="name">currentId</span> () const</h3>
<p>Returns the identifier of the HTTP request being executed or 0 if there is no request being executed (i.e&#x2e; they've all finished).</p>
<p><b>See also </b><a href="q3http.html#currentRequest">currentRequest</a>().</p>
<!-- @@@currentId -->
<!-- $$$currentRequest[overload1]$$$currentRequest -->
<h3 class="fn"><a name="currentRequest"></a><span class="type"><a href="q3httprequestheader.html">Q3HttpRequestHeader</a></span> Q3Http::<span class="name">currentRequest</span> () const</h3>
<p>Returns the request header of the HTTP request being executed. If the request is one issued by <a href="q3http.html#setHost">setHost</a>() or <a href="q3http.html#closeConnection">closeConnection</a>(), it returns an invalid request header, i.e&#x2e; <a href="q3httpheader.html#isValid">Q3HttpRequestHeader::isValid</a>() returns false.</p>
<p><b>See also </b><a href="q3http.html#currentId">currentId</a>().</p>
<!-- @@@currentRequest -->
<!-- $$$currentSourceDevice[overload1]$$$currentSourceDevice -->
<h3 class="fn"><a name="currentSourceDevice"></a><span class="type"><a href="qiodevice.html">QIODevice</a></span> * Q3Http::<span class="name">currentSourceDevice</span> () const</h3>
<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>
<p>This function can be used to delete the <a href="qiodevice.html">QIODevice</a> in the slot connected to the <a href="q3http.html#requestFinished">requestFinished</a>() signal.</p>
<p><b>See also </b><a href="q3http.html#currentDestinationDevice">currentDestinationDevice</a>(), <a href="q3http.html#post">post</a>(), and <a href="q3http.html#request">request</a>().</p>
<!-- @@@currentSourceDevice -->
<!-- $$$dataReadProgress[overload1]$$$dataReadProgressintint -->
<h3 class="fn"><a name="dataReadProgress"></a><span class="type">void</span> Q3Http::<span class="name">dataReadProgress</span> ( <span class="type">int</span> <i>done</i>, <span class="type">int</span> <i>total</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when this object reads data from a HTTP server to indicate the current progress of the download.</p>
<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>
<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>
<p><b>See also </b><a href="q3http.html#dataSendProgress">dataSendProgress</a>(), <a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#request">request</a>(), and <a href="qprogressbar.html#value-prop">QProgressBar::setValue</a>().</p>
<!-- @@@dataReadProgress -->
<!-- $$$dataSendProgress[overload1]$$$dataSendProgressintint -->
<h3 class="fn"><a name="dataSendProgress"></a><span class="type">void</span> Q3Http::<span class="name">dataSendProgress</span> ( <span class="type">int</span> <i>done</i>, <span class="type">int</span> <i>total</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when this object sends data to a HTTP server to inform it about the progress of the upload.</p>
<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>
<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>
<p><b>See also </b><a href="q3http.html#dataReadProgress">dataReadProgress</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#request">request</a>(), and <a href="qprogressbar.html#value-prop">QProgressBar::setValue</a>().</p>
<!-- @@@dataSendProgress -->
<!-- $$$done[overload1]$$$donebool -->
<h3 class="fn"><a name="done"></a><span class="type">void</span> Q3Http::<span class="name">done</span> ( <span class="type">bool</span> <i>error</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when the last pending request has finished; (it is emitted after the last request's <a href="q3http.html#requestFinished">requestFinished</a>() signal). <i>error</i> is true if an error occurred during the processing; otherwise <i>error</i> is false.</p>
<p><b>See also </b><a href="q3http.html#requestFinished">requestFinished</a>(), <a href="q3http.html#error">error</a>(), and <a href="q3http.html#errorString">errorString</a>().</p>
<!-- @@@done -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn"><a name="error"></a><span class="type"><a href="q3http.html#Error-enum">Error</a></span> Q3Http::<span class="name">error</span> () const</h3>
<p>Returns the last error that occurred. This is useful to find out what happened when receiving a <a href="q3http.html#requestFinished">requestFinished</a>() or a <a href="q3http.html#done">done</a>() signal with the <tt>error</tt> argument <tt>true</tt>.</p>
<p>If you start a new request, the error status is reset to <tt>NoError</tt>.</p>
<!-- @@@error -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn"><a name="errorString"></a><span class="type"><a href="qstring.html">QString</a></span> Q3Http::<span class="name">errorString</span> () const</h3>
<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="q3http.html#requestFinished">requestFinished</a>() or a <a href="q3http.html#done">done</a>() signal with the <tt>error</tt> argument <tt>true</tt>.</p>
<!-- @@@errorString -->
<!-- $$$get[overload1]$$$getconstQString&QIODevice* -->
<h3 class="fn"><a name="get"></a><span class="type">int</span> Q3Http::<span class="name">get</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>path</i>, <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>to</i> = 0 )</h3>
<p>Sends a get request for <i>path</i> to the server set by <a href="q3http.html#setHost">setHost</a>() or as specified in the constructor.</p>
<p><i>path</i> must be an absolute path like <tt>/index.html</tt> or an absolute URI like <tt>http://example.com/index.html</tt>.</p>
<p>If the IO device <i>to</i> is 0 the <a href="q3http.html#readyRead">readyRead</a>() signal is emitted every time new content data is available to read.</p>
<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="q3http.html#requestFinished">requestFinished</a>() signal is emitted).</p>
<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="q3http.html#requestStarted">requestStarted</a>() and <a href="q3http.html#requestFinished">requestFinished</a>().</p>
<p>When the request is started the <a href="q3http.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="q3http.html#requestFinished">requestFinished</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3http.html#setHost">setHost</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#head">head</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#requestStarted">requestStarted</a>(), <a href="q3http.html#requestFinished">requestFinished</a>(), and <a href="q3http.html#done">done</a>().</p>
<!-- @@@get -->
<!-- $$$hasPendingRequests[overload1]$$$hasPendingRequests -->
<h3 class="fn"><a name="hasPendingRequests"></a><span class="type">bool</span> Q3Http::<span class="name">hasPendingRequests</span> () const</h3>
<p>Returns true if there are any requests scheduled that have not yet been executed; otherwise returns false.</p>
<p>The request that is being executed is <i>not</i> considered as a scheduled request.</p>
<p><b>See also </b><a href="q3http.html#clearPendingRequests">clearPendingRequests</a>(), <a href="q3http.html#currentId">currentId</a>(), and <a href="q3http.html#currentRequest">currentRequest</a>().</p>
<!-- @@@hasPendingRequests -->
<!-- $$$head[overload1]$$$headconstQString& -->
<h3 class="fn"><a name="head"></a><span class="type">int</span> Q3Http::<span class="name">head</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>path</i> )</h3>
<p>Sends a header request for <i>path</i> to the server set by <a href="q3http.html#setHost">setHost</a>() or as specified in the constructor.</p>
<p><i>path</i> must be an absolute path like <tt>/index.html</tt> or an absolute URI like <tt>http://example.com/index.html</tt>.</p>
<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="q3http.html#requestStarted">requestStarted</a>() and <a href="q3http.html#requestFinished">requestFinished</a>().</p>
<p>When the request is started the <a href="q3http.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="q3http.html#requestFinished">requestFinished</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3http.html#setHost">setHost</a>(), <a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#requestStarted">requestStarted</a>(), <a href="q3http.html#requestFinished">requestFinished</a>(), and <a href="q3http.html#done">done</a>().</p>
<!-- @@@head -->
<!-- $$$operationGet[overload1]$$$operationGetQ3NetworkOperation* -->
<h3 class="fn"><a name="operationGet"></a><span class="type">void</span> Q3Http::<span class="name">operationGet</span> ( <span class="type"><a href="q3networkoperation.html">Q3NetworkOperation</a></span> * <i>op</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="q3networkprotocol.html#operationGet">Q3NetworkProtocol::operationGet</a>().</p>
<!-- @@@operationGet -->
<!-- $$$operationPut[overload1]$$$operationPutQ3NetworkOperation* -->
<h3 class="fn"><a name="operationPut"></a><span class="type">void</span> Q3Http::<span class="name">operationPut</span> ( <span class="type"><a href="q3networkoperation.html">Q3NetworkOperation</a></span> * <i>op</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="q3networkprotocol.html#operationPut">Q3NetworkProtocol::operationPut</a>().</p>
<!-- @@@operationPut -->
<!-- $$$post[overload1]$$$postconstQString&QIODevice*QIODevice* -->
<h3 class="fn"><a name="post"></a><span class="type">int</span> Q3Http::<span class="name">post</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>path</i>, <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>data</i>, <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>to</i> = 0 )</h3>
<p>Sends a post request for <i>path</i> to the server set by <a href="q3http.html#setHost">setHost</a>() or as specified in the constructor.</p>
<p><i>path</i> must be an absolute path like <tt>/index.html</tt> or an absolute URI like <tt>http://example.com/index.html</tt>.</p>
<p>The incoming data comes via the <i>data</i> IO device.</p>
<p>If the IO device <i>to</i> is 0 the <a href="q3http.html#readyRead">readyRead</a>() signal is emitted every time new content data is available to read.</p>
<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="q3http.html#requestFinished">requestFinished</a>() signal is emitted).</p>
<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="q3http.html#requestStarted">requestStarted</a>() and <a href="q3http.html#requestFinished">requestFinished</a>().</p>
<p>When the request is started the <a href="q3http.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="q3http.html#requestFinished">requestFinished</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3http.html#setHost">setHost</a>(), <a href="q3http.html#get">get</a>(), <a href="q3http.html#head">head</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#requestStarted">requestStarted</a>(), <a href="q3http.html#requestFinished">requestFinished</a>(), and <a href="q3http.html#done">done</a>().</p>
<!-- @@@post -->
<!-- $$$post$$$postconstQString&constQByteArray&QIODevice* -->
<h3 class="fn"><a name="post-2"></a><span class="type">int</span> Q3Http::<span class="name">post</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>path</i>, const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>data</i>, <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>to</i> = 0 )</h3>
<p>This is an overloaded function.</p>
<p><i>data</i> is used as the content data of the HTTP request.</p>
<!-- @@@post -->
<!-- $$$readAll[overload1]$$$readAll -->
<h3 class="fn"><a name="readAll"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> Q3Http::<span class="name">readAll</span> ()</h3>
<p>Reads all the bytes from the response content and returns them.</p>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#readyRead">readyRead</a>(), <a href="q3http.html#bytesAvailable">bytesAvailable</a>(), and <a href="q3http.html#readBlock">readBlock</a>().</p>
<!-- @@@readAll -->
<!-- $$$readBlock[overload1]$$$readBlockchar*Q_ULONG -->
<h3 class="fn"><a name="readBlock"></a><span class="type"><a href="qtglobal-qt3.html#Q_LONG-typedef">Q_LONG</a></span> Q3Http::<span class="name">readBlock</span> ( <span class="type">char</span> * <i>data</i>, <span class="type"><a href="qtglobal-qt3.html#Q_ULONG-typedef">Q_ULONG</a></span> <i>maxlen</i> )</h3>
<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>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#readyRead">readyRead</a>(), <a href="q3http.html#bytesAvailable">bytesAvailable</a>(), and <a href="q3http.html#readAll">readAll</a>().</p>
<!-- @@@readBlock -->
<!-- $$$readyRead[overload1]$$$readyReadconstQ3HttpResponseHeader& -->
<h3 class="fn"><a name="readyRead"></a><span class="type">void</span> Q3Http::<span class="name">readyRead</span> ( const <span class="type"><a href="q3httpresponseheader.html">Q3HttpResponseHeader</a></span> &amp; <i>resp</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when there is new response data to read.</p>
<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>
<p>The response header is passed in <i>resp</i>.</p>
<p>You can read the data with the <a href="q3http.html#readAll">readAll</a>() or <a href="q3http.html#readBlock">readBlock</a>() functions</p>
<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="q3http.html#requestFinished">requestFinished</a>() signal and read the data then instead.</p>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#readAll">readAll</a>(), <a href="q3http.html#readBlock">readBlock</a>(), and <a href="q3http.html#bytesAvailable">bytesAvailable</a>().</p>
<!-- @@@readyRead -->
<!-- $$$request[overload1]$$$requestconstQ3HttpRequestHeader&QIODevice*QIODevice* -->
<h3 class="fn"><a name="request"></a><span class="type">int</span> Q3Http::<span class="name">request</span> ( const <span class="type"><a href="q3httprequestheader.html">Q3HttpRequestHeader</a></span> &amp; <i>header</i>, <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>data</i> = 0, <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>to</i> = 0 )</h3>
<p>Sends a request to the server set by <a href="q3http.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>
<p>The incoming data comes via the <i>data</i> IO device.</p>
<p>If the IO device <i>to</i> is 0 the <a href="q3http.html#readyRead">readyRead</a>() signal is emitted every time new content data is available to read.</p>
<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="q3http.html#requestFinished">requestFinished</a>() signal is emitted).</p>
<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="q3http.html#requestStarted">requestStarted</a>() and <a href="q3http.html#requestFinished">requestFinished</a>().</p>
<p>When the request is started the <a href="q3http.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="q3http.html#requestFinished">requestFinished</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3http.html#setHost">setHost</a>(), <a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#head">head</a>(), <a href="q3http.html#requestStarted">requestStarted</a>(), <a href="q3http.html#requestFinished">requestFinished</a>(), and <a href="q3http.html#done">done</a>().</p>
<!-- @@@request -->
<!-- $$$request$$$requestconstQ3HttpRequestHeader&constQByteArray&QIODevice* -->
<h3 class="fn"><a name="request-2"></a><span class="type">int</span> Q3Http::<span class="name">request</span> ( const <span class="type"><a href="q3httprequestheader.html">Q3HttpRequestHeader</a></span> &amp; <i>header</i>, const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>data</i>, <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>to</i> = 0 )</h3>
<p>This is an overloaded function.</p>
<p><i>data</i> is used as the content data of the HTTP request.</p>
<!-- @@@request -->
<!-- $$$requestFinished[overload1]$$$requestFinishedintbool -->
<h3 class="fn"><a name="requestFinished"></a><span class="type">void</span> Q3Http::<span class="name">requestFinished</span> ( <span class="type">int</span> <i>id</i>, <span class="type">bool</span> <i>error</i> )<tt> [signal]</tt></h3>
<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>
<p><b>See also </b><a href="q3http.html#requestStarted">requestStarted</a>(), <a href="q3http.html#done">done</a>(), <a href="q3http.html#error">error</a>(), and <a href="q3http.html#errorString">errorString</a>().</p>
<!-- @@@requestFinished -->
<!-- $$$requestStarted[overload1]$$$requestStartedint -->
<h3 class="fn"><a name="requestStarted"></a><span class="type">void</span> Q3Http::<span class="name">requestStarted</span> ( <span class="type">int</span> <i>id</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when processing the request identified by <i>id</i> starts.</p>
<p><b>See also </b><a href="q3http.html#requestFinished">requestFinished</a>() and <a href="q3http.html#done">done</a>().</p>
<!-- @@@requestStarted -->
<!-- $$$responseHeaderReceived[overload1]$$$responseHeaderReceivedconstQ3HttpResponseHeader& -->
<h3 class="fn"><a name="responseHeaderReceived"></a><span class="type">void</span> Q3Http::<span class="name">responseHeaderReceived</span> ( const <span class="type"><a href="q3httpresponseheader.html">Q3HttpResponseHeader</a></span> &amp; <i>resp</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when the HTTP header of a server response is available. The header is passed in <i>resp</i>.</p>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#head">head</a>(), <a href="q3http.html#request">request</a>(), and <a href="q3http.html#readyRead">readyRead</a>().</p>
<!-- @@@responseHeaderReceived -->
<!-- $$$setHost[overload1]$$$setHostconstQString&Q_UINT16 -->
<h3 class="fn"><a name="setHost"></a><span class="type">int</span> Q3Http::<span class="name">setHost</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>hostname</i>, <span class="type"><a href="qtglobal-qt3.html#Q_UINT16-typedef">Q_UINT16</a></span> <i>port</i> = 80 )</h3>
<p>Sets the HTTP server that is used for requests to <i>hostname</i> on port <i>port</i>.</p>
<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="q3http.html#requestStarted">requestStarted</a>() and <a href="q3http.html#requestFinished">requestFinished</a>().</p>
<p>When the request is started the <a href="q3http.html#requestStarted">requestStarted</a>() signal is emitted. When it is finished the <a href="q3http.html#requestFinished">requestFinished</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#head">head</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#requestStarted">requestStarted</a>(), <a href="q3http.html#requestFinished">requestFinished</a>(), and <a href="q3http.html#done">done</a>().</p>
<!-- @@@setHost -->
<!-- $$$state[overload1]$$$state -->
<h3 class="fn"><a name="state"></a><span class="type"><a href="q3http.html#State-enum">State</a></span> Q3Http::<span class="name">state</span> () const</h3>
<p>Returns the current state of the object. When the state changes, the <a href="q3http.html#stateChanged">stateChanged</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3http.html#State-enum">State</a> and <a href="q3http.html#stateChanged">stateChanged</a>().</p>
<!-- @@@state -->
<!-- $$$stateChanged[overload1]$$$stateChangedint -->
<h3 class="fn"><a name="stateChanged"></a><span class="type">void</span> Q3Http::<span class="name">stateChanged</span> ( <span class="type">int</span> <i>state</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when the state of the <a href="q3http.html" class="compat">Q3Http</a> object changes. The argument <i>state</i> is the new state of the connection; it is one of the <a href="q3http.html#State-enum">State</a> values.</p>
<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="q3http.html#closeConnection">closeConnection</a>() succeeded.</p>
<p><b>See also </b><a href="q3http.html#get">get</a>(), <a href="q3http.html#post">post</a>(), <a href="q3http.html#head">head</a>(), <a href="q3http.html#request">request</a>(), <a href="q3http.html#closeConnection">closeConnection</a>(), <a href="q3http.html#state">state</a>(), and <a href="q3http.html#State-enum">State</a>.</p>
<!-- @@@stateChanged -->
<!-- $$$supportedOperations[overload1]$$$supportedOperations -->
<h3 class="fn"><a name="supportedOperations"></a><span class="type">int</span> Q3Http::<span class="name">supportedOperations</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="q3networkprotocol.html#supportedOperations">Q3NetworkProtocol::supportedOperations</a>().</p>
<!-- @@@supportedOperations -->
<!-- $$$timerEvent[overload1]$$$timerEventQTimerEvent* -->
<h3 class="fn"><a name="timerEvent"></a><span class="type">void</span> Q3Http::<span class="name">timerEvent</span> ( <span class="type"><a href="qtimerevent.html">QTimerEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#timerEvent">QObject::timerEvent</a>().</p>
<!-- @@@timerEvent -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>