Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

int QHttp::get ( const QString path,
QIODevice to = 0 
)

Sends a get request for path to the server set by setHost() or as specified in the constructor.

path must be an absolute path like /index.html or an absolute URI like http://www.trolltech.com/index.html.

If the IO device to is 0 the readyRead() signal is emitted every time new content data is available to read.

If the IO device to is not 0, the content data of the response is written directly to the device. Make sure that the to pointer is valid for the duration of the operation (it is safe to delete it when the requestFinished() signal is emitted).

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 requestStarted() and requestFinished().

When the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted.

See also:
setHost() post() head() request() requestStarted() requestFinished() done()

Definition at line 2008 of file qhttp.cpp.

References QHttpHeader::setValue().

{
    Q_D(QHttp);
    QHttpRequestHeader header("GET", path);
    header.setValue("Connection", "Keep-Alive");
    return d->addRequest(new QHttpPGHRequest(header, (QIODevice *) 0, to));
}


Generated by  Doxygen 1.6.0   Back to index