⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qhttp.3qt

📁 这个是Linux的qt源代码
💻 3QT
📖 第 1 页 / 共 2 页
字号:
The functions hasPendingRequests() and clearPendingRequests() allow you to query and clear the list of pending requests..PPSee also Qt Network Documentation, QNetworkProtocol, QUrlOperator, QFtp, and Input/Output and Networking..SS "Member Type Documentation".SH "QHttp::Error"This enum identifies the error that occurred..TP\fCQHttp::NoError\fR - No error occurred..TP\fCQHttp::HostNotFound\fR - The host name lookup failed..TP\fCQHttp::ConnectionRefused\fR - The server refused the connection..TP\fCQHttp::UnexpectedClose\fR - The server closed the connection unexpectedly..TP\fCQHttp::InvalidResponseHeader\fR - The server sent an invalid response header..TP\fCQHttp::WrongContentLength\fR - The client could not read the content correctly because an error with respect to the content length occurred..TP\fCQHttp::Aborted\fR - The request was aborted with abort()..TP\fCQHttp::UnknownError\fR - An error other than those specified above occurred..PPSee also error()..SH "QHttp::State"This enum is used to specify the state the client is in:.TP\fCQHttp::Unconnected\fR - There is no connection to the host..TP\fCQHttp::HostLookup\fR - A host name lookup is in progress..TP\fCQHttp::Connecting\fR - An attempt to connect to the host is in progress..TP\fCQHttp::Sending\fR - The client is sending its request to the server..TP\fCQHttp::Reading\fR - The client's request has been sent and the client is reading the server's response..TP\fCQHttp::Connected\fR - The connection to the host is open, but the client is neither sending a request, nor waiting for a response..TP\fCQHttp::Closing\fR - The connection is closing down, but is not yet closed. (The state will be Unconnected when the connection is closed.).PPSee also stateChanged() and state()..SH MEMBER FUNCTION DOCUMENTATION.SH "QHttp::QHttp ()"Constructs a QHttp object..SH "QHttp::QHttp ( QObject * parent, const char * name = 0 )"Constructs a QHttp object. The parameters \fIparent\fR and \fIname\fR are passed on to the QObject constructor..SH "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 \fIhostname\fR on port \fIport\fR. The parameters \fIparent\fR and \fIname\fR are passed on to the QObject constructor..PPSee also setHost()..SH "QHttp::~QHttp ()\fC [virtual]\fR"Destroys the QHttp object. If there is an open connection, it is closed..SH "void QHttp::abort ()\fC [slot]\fR"Aborts the current request and deletes all scheduled requests..PPFor the current request, the requestFinished() signal with the \fCerror\fR argument \fCTRUE\fR is emitted. For all other requests that are affected by the abort(), no signals are emitted..PPSince this slot also deletes the scheduled requests, there are no requests left and the done() signal is emitted (with the \fCerror\fR argument \fCTRUE\fR)..PPSee also clearPendingRequests()..SH "Q_ULONG QHttp::bytesAvailable () const"Returns the number of bytes that can be read from the response content at the moment..PPSee also get(), post(), request(), readyRead(), readBlock(), and readAll()..SH "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()..PPSee also hasPendingRequests() and abort()..SH "int QHttp::closeConnection ()"Closes the connection; this is useful if you have a keep-alive connection and want to close it..PPFor 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..PPThe 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()..PPWhen the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted..PPIf you want to close the connection immediately, you have to use abort() instead..PPSee also stateChanged(), abort(), requestStarted(), requestFinished(), and done()..SH "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..PPThis function can be used to delete the QIODevice in the slot connected to the requestFinished() signal..PPSee also get(), post(), and request()..SH "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)..PPSee also currentRequest()..SH "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..PPSee also currentId()..SH "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..PPThis function can be used to delete the QIODevice in the slot connected to the requestFinished() signal..PPSee also currentDestinationDevice(), post(), and request()..SH "void QHttp::dataReadProgress ( int done, int total )\fC [signal]\fR"This signal is emitted when this object reads data from a HTTP server to indicate the current progress of the download..PP\fIdone\fR is the amount of data that has already arrived and \fItotal\fR 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 \fItotal\fR is 0.(If you connect to a QProgressBar, the progress bar shows a busy indicator if the total is 0)..PP\fBWarning:\fR \fIdone\fR and \fItotal\fR are not necessarily the size in bytes, since for large files these values might need to be" scaled" to avoid overflow..PPSee also dataSendProgress(), get(), post(), request(), and QProgressBar::progress..SH "void QHttp::dataSendProgress ( int done, int total )\fC [signal]\fR"This signal is emitted when this object sends data to a HTTP server to inform it about the progress of the upload..PP\fIdone\fR is the amount of data that has already arrived and \fItotal\fR 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 \fItotal\fR is 0.(If you connect to a QProgressBar, the progress bar shows a busy indicator if the total is 0)..PP\fBWarning:\fR \fIdone\fR and \fItotal\fR are not necessarily the size in bytes, since for large files these values might need to be" scaled" to avoid overflow..PPSee also dataReadProgress(), post(), request(), and QProgressBar::progress..SH "void QHttp::done ( bool error )\fC [signal]\fR"This signal is emitted when the last pending request has finished; (it is emitted after the last request's requestFinished() signal). \fIerror\fR is TRUE if an error occurred during the processing; otherwise \fIerror\fR is FALSE..PPSee also requestFinished(), error(), and errorString()..SH "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 \fCerror\fR argument \fCTRUE\fR..PPIf you start a new request, the error status is reset to NoError..SH "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 \fCerror\fR argument \fCTRUE\fR..SH "int QHttp::get ( const QString & path, QIODevice * to = 0 )"Sends a get request for \fIpath\fR to the server set by setHost() or as specified in the constructor..PP\fIpath\fR must be an absolute path like \fC/index.html\fR or an absolute URI like http://www.trolltech.com/index.html..PPIf the IO device \fIto\fR is 0 the readyRead() signal is emitted every time new content data is available to read..PPIf the IO device \fIto\fR is not 0, the content data of the response is written directly to the device. Make sure that the \fIto\fR pointer is valid for the duration of the operation (it is safe to delete it when the requestFinished() signal is emitted)..PPThe 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()..PPWhen the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted..PPSee also setHost(), post(), head(), request(), requestStarted(), requestFinished(), and done()..SH "bool QHttp::hasPendingRequests () const"Returns TRUE if there are any requests scheduled that have not yet been executed; otherwise returns FALSE..PPThe request that is being executed is \fInot\fR considered as a scheduled request..PPSee also clearPendingRequests(), currentId(), and currentRequest()..SH "int QHttp::head ( const QString & path )"Sends a header request for \fIpath\fR to the server set by setHost() or as specified in the constructor..PP\fIpath\fR must be an absolute path like \fC/index.html\fR or an absolute URI like http://www.trolltech.com/index.html..PPThe 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()..PPWhen the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted..PPSee also setHost(), get(), post(), request(), requestStarted(), requestFinished(), and done()..SH "int QHttp::post ( const QString & path, QIODevice * data, QIODevice * to = 0 )"Sends a post request for \fIpath\fR to the server set by setHost() or as specified in the constructor..PP\fIpath\fR must be an absolute path like \fC/index.html\fR or an absolute URI like http://www.trolltech.com/index.html..PPThe incoming data comes via the \fIdata\fR IO device..PPIf the IO device \fIto\fR is 0 the readyRead() signal is emitted every time new content data is available to read..PPIf the IO device \fIto\fR is not 0, the content data of the response is written directly to the device. Make sure that the \fIto\fR pointer is valid for the duration of the operation (it is safe to delete it when the requestFinished() signal is emitted)..PPThe 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()..PPWhen the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted..PPSee also setHost(), get(), head(), request(), requestStarted(), requestFinished(), and done()..SH "int QHttp::post ( const QString & path, const QByteArray & data, QIODevice * to = 0 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PP\fIdata\fR is used as the content data of the HTTP request..SH "QByteArray QHttp::readAll ()"Reads all the bytes from the response content and returns them..PPSee also get(), post(), request(), readyRead(), bytesAvailable(), and readBlock()..SH "Q_LONG QHttp::readBlock ( char * data, Q_ULONG maxlen )"Reads \fImaxlen\fR bytes from the response content into \fIdata\fR and returns the number of bytes read. Returns -1 if an error occurred..PPSee also get(), post(), request(), readyRead(), bytesAvailable(), and readAll()..SH "void QHttp::readyRead ( const QHttpResponseHeader & resp )\fC [signal]\fR"This signal is emitted when there is new response data to read..PPIf you specified a device in the request where the data should be written to, then this signal is \fInot\fR emitted; instead the data is written directly to the device..PPThe response header is passed in \fIresp\fR..PPYou can read the data with the readAll() or readBlock() functions.PPThis 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..PPSee also get(), post(), request(), readAll(), readBlock(), and bytesAvailable()..SH "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 \fIheader\fR as the HTTP request header. You are responsible for setting up a header that is appropriate for your request..PPThe incoming data comes via the \fIdata\fR IO device..PPIf the IO device \fIto\fR is 0 the readyRead() signal is emitted every time new content data is available to read..PPIf the IO device \fIto\fR is not 0, the content data of the response is written directly to the device. Make sure that the \fIto\fR pointer is valid for the duration of the operation (it is safe to delete it when the requestFinished() signal is emitted)..PPThe 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()..PPWhen the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted..PPSee also setHost(), get(), post(), head(), requestStarted(), requestFinished(), and done()..SH "int QHttp::request ( const QHttpRequestHeader & header, const QByteArray & data, QIODevice * to = 0 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PP\fIdata\fR is used as the content data of the HTTP request..SH "void QHttp::requestFinished ( int id, bool error )\fC [signal]\fR"This signal is emitted when processing the request identified by \fIid\fR has finished. \fIerror\fR is TRUE if an error occurred during the processing; otherwise \fIerror\fR is FALSE..PPSee also requestStarted(), done(), error(), and errorString()..SH "void QHttp::requestStarted ( int id )\fC [signal]\fR"This signal is emitted when processing the request identified by \fIid\fR starts..PPSee also requestFinished() and done()..SH "void QHttp::responseHeaderReceived ( const QHttpResponseHeader & resp )\fC [signal]\fR"This signal is emitted when the HTTP header of a server response is available. The header is passed in \fIresp\fR..PPSee also get(), post(), head(), request(), and readyRead()..SH "int QHttp::setHost ( const QString & hostname, Q_UINT16 port = 80 )"Sets the HTTP server that is used for requests to \fIhostname\fR on port \fIport\fR..PPThe 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()..PPWhen the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted..PPSee also get(), post(), head(), request(), requestStarted(), requestFinished(), and done()..SH "State QHttp::state () const"Returns the current state of the object. When the state changes, the stateChanged() signal is emitted..PPSee also State and stateChanged()..SH "void QHttp::stateChanged ( int state )\fC [signal]\fR"This signal is emitted when the state of the QHttp object changes. The argument \fIstate\fR is the new state of the connection; it is one of the State values..PPThis 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..PPSee also get(), post(), head(), request(), closeConnection(), state(), and State..SH "SEE ALSO".BR http://doc.trolltech.com/qhttp.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qhttp.3qt) and the Qtversion (3.2.3).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -