Eneboo - Documentación para desarrolladores
Tipos públicos | Slots públicos | Señales | Métodos públicos | Métodos protegidos | Amigas
Referencia de la Clase QHttp

The QHttp class provides an implementation of the HTTP protocol.network. Más...

#include <qhttp.h>

Diagrama de herencias de QHttp
QNetworkProtocol QNetworkProtocol QObject QObject QObject QObject Qt Qt Qt Qt Qt Qt Qt Qt

Lista de todos los miembros.

Tipos públicos

enum  State {
  Unconnected, HostLookup, Connecting, Sending,
  Reading, Connected, Closing, Unconnected,
  HostLookup, Connecting, Sending, Reading,
  Connected, Closing
}
enum  Error {
  NoError, UnknownError, HostNotFound, ConnectionRefused,
  UnexpectedClose, InvalidResponseHeader, WrongContentLength, Aborted,
  NoError, UnknownError, HostNotFound, ConnectionRefused,
  UnexpectedClose, InvalidResponseHeader, WrongContentLength, Aborted
}
enum  State {
  Unconnected, HostLookup, Connecting, Sending,
  Reading, Connected, Closing, Unconnected,
  HostLookup, Connecting, Sending, Reading,
  Connected, Closing
}
enum  Error {
  NoError, UnknownError, HostNotFound, ConnectionRefused,
  UnexpectedClose, InvalidResponseHeader, WrongContentLength, Aborted,
  NoError, UnknownError, HostNotFound, ConnectionRefused,
  UnexpectedClose, InvalidResponseHeader, WrongContentLength, Aborted
}

Slots públicos

void abort ()
void abort ()

Señales

void stateChanged (int)
void responseHeaderReceived (const QHttpResponseHeader &resp)
void readyRead (const QHttpResponseHeader &resp)
void dataSendProgress (int, int)
void dataReadProgress (int, int)
void requestStarted (int)
void requestFinished (int, bool)
void done (bool)
void stateChanged (int)
void responseHeaderReceived (const QHttpResponseHeader &resp)
void readyRead (const QHttpResponseHeader &resp)
void dataSendProgress (int, int)
void dataReadProgress (int, int)
void requestStarted (int)
void requestFinished (int, bool)
void done (bool)

Métodos públicos

 QHttp ()
 QHttp (QObject *parent, const char *name=0)
 QHttp (const QString &hostname, Q_UINT16 port=80, QObject *parent=0, const char *name=0)
virtual ~QHttp ()
int supportedOperations () const
int setHost (const QString &hostname, Q_UINT16 port=80)
int get (const QString &path, QIODevice *to=0)
int post (const QString &path, QIODevice *data, QIODevice *to=0)
int post (const QString &path, const QByteArray &data, QIODevice *to=0)
int head (const QString &path)
int request (const QHttpRequestHeader &header, QIODevice *device=0, QIODevice *to=0)
int request (const QHttpRequestHeader &header, const QByteArray &data, QIODevice *to=0)
int closeConnection ()
Q_ULONG bytesAvailable () const
Q_LONG readBlock (char *data, Q_ULONG maxlen)
QByteArray readAll ()
int currentId () const
QIODevicecurrentSourceDevice () const
QIODevicecurrentDestinationDevice () const
QHttpRequestHeader currentRequest () const
bool hasPendingRequests () const
void clearPendingRequests ()
State state () const
Error error () const
QString errorString () const
 QHttp ()
 QHttp (QObject *parent, const char *name=0)
 QHttp (const QString &hostname, Q_UINT16 port=80, QObject *parent=0, const char *name=0)
virtual ~QHttp ()
int supportedOperations () const
int setHost (const QString &hostname, Q_UINT16 port=80)
int get (const QString &path, QIODevice *to=0)
int post (const QString &path, QIODevice *data, QIODevice *to=0)
int post (const QString &path, const QByteArray &data, QIODevice *to=0)
int head (const QString &path)
int request (const QHttpRequestHeader &header, QIODevice *device=0, QIODevice *to=0)
int request (const QHttpRequestHeader &header, const QByteArray &data, QIODevice *to=0)
int closeConnection ()
Q_ULONG bytesAvailable () const
Q_LONG readBlock (char *data, Q_ULONG maxlen)
QByteArray readAll ()
int currentId () const
QIODevicecurrentSourceDevice () const
QIODevicecurrentDestinationDevice () const
QHttpRequestHeader currentRequest () const
bool hasPendingRequests () const
void clearPendingRequests ()
State state () const
Error error () const
QString errorString () const

Métodos protegidos

void operationGet (QNetworkOperation *op)
void operationPut (QNetworkOperation *op)
void timerEvent (QTimerEvent *)
void operationGet (QNetworkOperation *op)
void operationPut (QNetworkOperation *op)
void timerEvent (QTimerEvent *)

Amigas

class QHttpNormalRequest
class QHttpSetHostRequest
class QHttpCloseRequest
class QHttpPGHRequest

Descripción detallada

The QHttp class provides an implementation of the HTTP protocol.

network.

This class provides two different interfaces: one is the QNetworkProtocol interface that allows you to use HTTP through the QUrlOperator 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.

Don't mix the two interfaces, since the behavior is not well-defined.

If you want to use QHttp with the QNetworkProtocol interface, you do not use it directly, but rather through a QUrlOperator, for example:

    QUrlOperator op( "http://www.trolltech.com" );
    op.get( "index.html" );

This code will only work if the QHttp class is registered; to register the class, you must call qInitNetworkProtocols() before using a QUrlOperator with HTTP.

The QNetworkProtocol interface for HTTP only supports the operations operationGet() and operationPut(), i.e. QUrlOperator::get() and QUrlOperator::put(), if you use it with a QUrlOperator.

The rest of this descrption describes the direct interface to HTTP.

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.

The operations that can be scheduled (they are called "requests" in the rest of the documentation) are the following: setHost(), get(), post(), head() and request().

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 requestStarted() signal with the identifier is emitted and when the request is finished, the requestFinished() signal is emitted with the identifier and a bool that indicates if the request finished with an error.

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 http://www.trolltech.com/index.html):

    QHttpRequestHeader header( "GET", "/index.html" );
    header.setValue( "Host", "www.trolltech.com" );
    http->setHost( "www.trolltech.com" );
    http->request( header );

For the common HTTP requests GET, POST and HEAD, QHttp provides the convenience functions get(), post() and head(). 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:

    http->setHost( "www.trolltech.com" ); // id == 1
    http->get( "/index.html" );           // id == 2

For this example the following sequence of signals is emitted (with small variations, depending on network traffic, etc.):

The dataSendProgress() and dataReadProgress() signals in the above example are useful if you want to show a progressbar 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 QProgressBar a total of 0 results in a busy indicator.)

When the response header is read, it is reported with the responseHeaderReceived() signal.

The readyRead() signal tells you that there is data ready to be read. The amount of data can then be queried with the bytesAvailable() function and it can be read with the readBlock() or readAll() functions.

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.

For example, if you have the following sequence of reqeusts

    http->setHost( "www.foo.bar" );       // id == 1
    http->get( "/index.html" );           // id == 2
    http->post( "register.html", data );  // id == 3

and the get() request fails because the host lookup fails, then the post() request is never executed and the signals would look like this:

    requestStarted( 1 )
    requestFinished( 1, FALSE )

    requestStarted( 2 )
    stateChanged( HostLookup )
    requestFinished( 2, TRUE )

    done( TRUE )

    stateChanged( Unconnected )

You can then get details about the error with the error() and errorString() 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 status code of the response header.

The functions currentId() and currentRequest() provide more information about the currently executing request.

The functions hasPendingRequests() and clearPendingRequests() allow you to query and clear the list of pending requests.

Ver también:
Qt Network Documentation QNetworkProtocol, QUrlOperator QFtp

Documentación de las enumeraciones miembro de la clase

This enum identifies the error that occurred.

NoError No error occurred. HostNotFound The host name lookup failed. ConnectionRefused The server refused the connection. UnexpectedClose The server closed the connection unexpectedly. InvalidResponseHeader The server sent an invalid response header. WrongContentLength The client could not read the content correctly because an error with respect to the content length occurred. Aborted The request was aborted with abort(). UnknownError An error other than those specified above occurred.

Ver también:
error()
Valores de enumeraciones:
NoError 
UnknownError 
HostNotFound 
ConnectionRefused 
UnexpectedClose 
InvalidResponseHeader 
WrongContentLength 
Aborted 
NoError 
UnknownError 
HostNotFound 
ConnectionRefused 
UnexpectedClose 
InvalidResponseHeader 
WrongContentLength 
Aborted 

Reimplementado de QNetworkProtocol.

When an operation fails (finishes unsuccessfully), the QNetworkOperation of the operation returns an error code which has one of the following values:

NoError No error occurred.

ErrValid The URL you are operating on is not valid.

ErrUnknownProtocol There is no protocol implementation available for the protocol of the URL you are operating on (e.g. if the protocol is http and no http implementation has been registered).

ErrUnsupported The operation is not supported by the protocol.

ErrParse The URL could not be parsed correctly.

ErrLoginIncorrect You needed to login but the username or password is wrong.

ErrHostNotFound The specified host (in the URL) couldn't be found.

ErrListChildren An error occurred while listing the children (files).

ErrMkDir An error occurred when creating a directory.

ErrRemove An error occurred when removing a child (file).

ErrRename An error occurred when renaming a child (file).

ErrGet An error occurred while getting (retrieving) data.

ErrPut An error occurred while putting (uploading) data.

ErrFileNotExisting A file which is needed by the operation doesn't exist.

ErrPermissionDenied Permission for doing the operation has been denied.

You should also use these error codes when implementing custom network protocols. If this is not possible, you can define your own error codes by using integer values that don't conflict with any of these values.

Valores de enumeraciones:
NoError 
UnknownError 
HostNotFound 
ConnectionRefused 
UnexpectedClose 
InvalidResponseHeader 
WrongContentLength 
Aborted 
NoError 
UnknownError 
HostNotFound 
ConnectionRefused 
UnexpectedClose 
InvalidResponseHeader 
WrongContentLength 
Aborted 

Reimplementado de QNetworkProtocol.

This enum contains the state that a QNetworkOperation can have.

StWaiting The operation is in the QNetworkProtocol's queue waiting to be prcessed.

StInProgress The operation is being processed.

StDone The operation has been processed succesfully.

StFailed The operation has been processed but an error occurred.

StStopped The operation has been processed but has been stopped before it finished, and is waiting to be processed.

Valores de enumeraciones:
Unconnected 
HostLookup 
Connecting 
Sending 
Reading 
Connected 
Closing 
Unconnected 
HostLookup 
Connecting 
Sending 
Reading 
Connected 
Closing 

Reimplementado de QNetworkProtocol.

This enum is used to specify the state the client is in:

Unconnected There is no connection to the host. HostLookup A host name lookup is in progress. Connecting An attempt to connect to the host is in progress. Sending The client is sending its request to the server. Reading The client's request has been sent and the client is reading the server's response. Connected The connection to the host is open, but the client is neither sending a request, nor waiting for a response. Closing The connection is closing down, but is not yet closed. (The state will be Unconnected when the connection is closed.)

Ver también:
stateChanged() state()
Valores de enumeraciones:
Unconnected 
HostLookup 
Connecting 
Sending 
Reading 
Connected 
Closing 
Unconnected 
HostLookup 
Connecting 
Sending 
Reading 
Connected 
Closing 

Reimplementado de QNetworkProtocol.


Documentación del constructor y destructor

QHttp::QHttp ( )

Constructs a QHttp object.

QHttp::QHttp ( QObject parent,
const char *  name = 0 
)

Constructs a QHttp object. The parameters parent and name are passed on to the QObject constructor.

QHttp::QHttp ( const QString hostname,
Q_UINT16  port = 80,
QObject parent = 0,
const char *  name = 0 
)

Constructs a QHttp object. Subsequent requests are done by connecting to the server hostname on port port. The parameters parent and name are passed on to the QObject constructor.

Ver también:
setHost()
QHttp::~QHttp ( ) [virtual]

Destroys the QHttp object. If there is an open connection, it is closed.

QHttp::QHttp ( )
QHttp::QHttp ( QObject parent,
const char *  name = 0 
)
QHttp::QHttp ( const QString hostname,
Q_UINT16  port = 80,
QObject parent = 0,
const char *  name = 0 
)
virtual QHttp::~QHttp ( ) [virtual]

Documentación de las funciones miembro

void QHttp::abort ( ) [slot]

Aborts the current request and deletes all scheduled requests.

For the current request, the requestFinished() signal with the error argument TRUE is emitted. For all other requests that are affected by the abort(), no signals are emitted.

Since this slot also deletes the scheduled requests, there are no requests left and the done() signal is emitted (with the error argument TRUE).

Ver también:
clearPendingRequests()
void QHttp::abort ( ) [slot]
Q_ULONG QHttp::bytesAvailable ( ) const

Returns the number of bytes that can be read from the response content at the moment.

Ver también:
get() post() request() readyRead() readBlock() readAll()
Q_ULONG QHttp::bytesAvailable ( ) const
void QHttp::clearPendingRequests ( )

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 abort().

Ver también:
hasPendingRequests() abort()
void QHttp::clearPendingRequests ( )
int QHttp::closeConnection ( )

Closes the connection; this is useful if you have a keep-alive connection and want to close it.

For the requests issued with get(), post() and head(), QHttp sets the connection to be keep-alive. You can also do this using the header you pass to the request() function. QHttp only closes the connection to the HTTP server if the response header requires it to do so.

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.

If you want to close the connection immediately, you have to use abort() instead.

Ver también:
stateChanged() abort() requestStarted() requestFinished() done()
int QHttp::closeConnection ( )
QIODevice* QHttp::currentDestinationDevice ( ) const
QIODevice * QHttp::currentDestinationDevice ( ) const

Returns the QIODevice 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.

This function can be used to delete the QIODevice in the slot connected to the requestFinished() signal.

Ver también:
currentDestinationDevice() get() post() request()
int QHttp::currentId ( ) const
int QHttp::currentId ( ) const

Returns the identifier of the HTTP request being executed or 0 if there is no request being executed (i.e. they've all finished).

Ver también:
currentRequest()
QHttpRequestHeader QHttp::currentRequest ( ) const

Returns the request header of the HTTP request being executed. If the request is one issued by setHost() or closeConnection(), it returns an invalid request header, i.e. QHttpRequestHeader::isValid() returns FALSE.

Ver también:
currentId()
QHttpRequestHeader QHttp::currentRequest ( ) const
QIODevice* QHttp::currentSourceDevice ( ) const
QIODevice * QHttp::currentSourceDevice ( ) const

Returns the QIODevice 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.

This function can be used to delete the QIODevice in the slot connected to the requestFinished() signal.

Ver también:
currentDestinationDevice() post() request()
void QHttp::dataReadProgress ( int  done,
int  total 
) [signal]

This signal is emitted when this object reads data from a HTTP server to indicate the current progress of the download.

done is the amount of data that has already arrived and total 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 total is 0.(If you connect to a QProgressBar, the progress bar shows a busy indicator if the total is 0).

Atención:
done and total are not necessarily the size in bytes, since for large files these values might need to be "scaled" to avoid overflow.
Ver también:
dataSendProgress() get() post() request() QProgressBar::setProgress()
void QHttp::dataReadProgress ( int  ,
int   
) [signal]
void QHttp::dataSendProgress ( int  done,
int  total 
) [signal]

This signal is emitted when this object sends data to a HTTP server to inform it about the progress of the upload.

done is the amount of data that has already arrived and total 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 total is 0.(If you connect to a QProgressBar, the progress bar shows a busy indicator if the total is 0).

Atención:
done and total are not necessarily the size in bytes, since for large files these values might need to be "scaled" to avoid overflow.
Ver también:
dataReadProgress() post() request() QProgressBar::setProgress()
void QHttp::dataSendProgress ( int  ,
int   
) [signal]
void QHttp::done ( bool  error) [signal]

This signal is emitted when the last pending request has finished; (it is emitted after the last request's requestFinished() signal). error is TRUE if an error occurred during the processing; otherwise error is FALSE.

Ver también:
requestFinished() error() errorString()
void QHttp::done ( bool  ) [signal]
QHttp::Error QHttp::error ( ) const

Returns the last error that occurred. This is useful to find out what happened when receiving a requestFinished() or a done() signal with the error argument TRUE.

If you start a new request, the error status is reset to NoError.

Error QHttp::error ( ) const
QString QHttp::errorString ( ) const

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 requestFinished() or a done() signal with the error argument TRUE.

QString QHttp::errorString ( ) const
int QHttp::get ( const QString path,
QIODevice to = 0 
)
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.

Ver también:
setHost() post() head() request() requestStarted() requestFinished() done()
bool QHttp::hasPendingRequests ( ) const

Returns TRUE if there are any requests scheduled that have not yet been executed; otherwise returns FALSE.

The request that is being executed is not considered as a scheduled request.

Ver también:
clearPendingRequests() currentId() currentRequest()
bool QHttp::hasPendingRequests ( ) const
int QHttp::head ( const QString path)
int QHttp::head ( const QString path)

Sends a header 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.

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.

Ver también:
setHost() get() post() request() requestStarted() requestFinished() done()
void QHttp::operationGet ( QNetworkOperation op) [protected, virtual]

When implementing a new network protocol, this method should be reimplemented if the protocol supports getting data; this method should then process the QNetworkOperation.

When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the Qt Network Documentation which describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.

op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.

Reimplementado de QNetworkProtocol.

void QHttp::operationGet ( QNetworkOperation op) [protected, virtual]

Reimplementado de QNetworkProtocol.

void QHttp::operationPut ( QNetworkOperation op) [protected, virtual]

Reimplementado de QNetworkProtocol.

void QHttp::operationPut ( QNetworkOperation op) [protected, virtual]

When implementing a new network protocol, this method should be reimplemented if the protocol supports putting (uploading) data; this method should then process the QNetworkOperation.

When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the Qt Network Documentation which describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.

op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.

Reimplementado de QNetworkProtocol.

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

Sends a post 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.

The incoming data comes via the data IO device.

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.

Ver también:
setHost() get() head() request() requestStarted() requestFinished() done()
int QHttp::post ( const QString path,
QIODevice data,
QIODevice to = 0 
)
int QHttp::post ( const QString path,
const QByteArray data,
QIODevice to = 0 
)
int QHttp::post ( const QString path,
const QByteArray data,
QIODevice to = 0 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. data is used as the content data of the HTTP request.

QByteArray QHttp::readAll ( )

Reads all the bytes from the response content and returns them.

Ver también:
get() post() request() readyRead() bytesAvailable() readBlock()
QByteArray QHttp::readAll ( )
Q_LONG QHttp::readBlock ( char *  data,
Q_ULONG  maxlen 
)

Reads maxlen bytes from the response content into data and returns the number of bytes read. Returns -1 if an error occurred.

Ver también:
get() post() request() readyRead() bytesAvailable() readAll()
Q_LONG QHttp::readBlock ( char *  data,
Q_ULONG  maxlen 
)
void QHttp::readyRead ( const QHttpResponseHeader resp) [signal]

This signal is emitted when there is new response data to read.

If you specified a device in the request where the data should be written to, then this signal is not emitted; instead the data is written directly to the device.

The response header is passed in resp.

You can read the data with the readAll() or readBlock() functions

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 requestFinished() signal and read the data then instead.

Ver también:
get() post() request() readAll() readBlock() bytesAvailable()
void QHttp::readyRead ( const QHttpResponseHeader resp) [signal]
int QHttp::request ( const QHttpRequestHeader header,
QIODevice device = 0,
QIODevice to = 0 
)
int QHttp::request ( const QHttpRequestHeader header,
const QByteArray data,
QIODevice to = 0 
)
int QHttp::request ( const QHttpRequestHeader header,
const QByteArray data,
QIODevice to = 0 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. data is used as the content data of the HTTP request.

int QHttp::request ( const QHttpRequestHeader header,
QIODevice data = 0,
QIODevice to = 0 
)

Sends a request to the server set by setHost() or as specified in the constructor. Uses the header as the HTTP request header. You are responsible for setting up a header that is appropriate for your request.

The incoming data comes via the data IO device.

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.

Ver también:
setHost() get() post() head() requestStarted() requestFinished() done()
void QHttp::requestFinished ( int  id,
bool  error 
) [signal]

This signal is emitted when processing the request identified by id has finished. error is TRUE if an error occurred during the processing; otherwise error is FALSE.

Ver también:
requestStarted() done() error() errorString()
void QHttp::requestFinished ( int  ,
bool   
) [signal]
void QHttp::requestStarted ( int  ) [signal]
void QHttp::requestStarted ( int  id) [signal]

This signal is emitted when processing the request identified by id starts.

Ver también:
requestFinished() done()
void QHttp::responseHeaderReceived ( const QHttpResponseHeader resp) [signal]
void QHttp::responseHeaderReceived ( const QHttpResponseHeader resp) [signal]

This signal is emitted when the HTTP header of a server response is available. The header is passed in resp.

Ver también:
get() post() head() request() readyRead()
int QHttp::setHost ( const QString hostname,
Q_UINT16  port = 80 
)
int QHttp::setHost ( const QString hostname,
Q_UINT16  port = 80 
)

Sets the HTTP server that is used for requests to hostname on port port.

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.

Ver también:
get() post() head() request() requestStarted() requestFinished() done()
QHttp::State QHttp::state ( ) const

Returns the current state of the object. When the state changes, the stateChanged() signal is emitted.

Ver también:
State stateChanged()
State QHttp::state ( ) const
void QHttp::stateChanged ( int  ) [signal]
void QHttp::stateChanged ( int  state) [signal]

This signal is emitted when the state of the QHttp object changes. The argument state is the new state of the connection; it is one of the State values.

This usually happens when a request is started, but it can also happen when the server closes the connection or when a call to closeConnection() succeeded.

Ver también:
get() post() head() request() closeConnection() state() State
int QHttp::supportedOperations ( ) const [virtual]

Returns an int that is OR'd together using the enum values of {QNetworkProtocol::Operation}, which describes which operations are supported by the network protocol. Should be reimplemented by new network protocols.

Reimplementado de QNetworkProtocol.

int QHttp::supportedOperations ( ) const [virtual]

Reimplementado de QNetworkProtocol.

void QHttp::timerEvent ( QTimerEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive timer events for the object.

QTimer provides a higher-level interface to the timer functionality, and also more general information about timers.

Ver también:
startTimer(), killTimer(), killTimers(), event()

Reimplementado de QObject.

void QHttp::timerEvent ( QTimerEvent e) [protected, virtual]

Reimplementado de QObject.


Documentación de las funciones relacionadas y clases amigas

QHttpPGHRequest [friend]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'