KVIrc
4.9.2
DeveloperAPIs
|
The QHttpRequestHeader class contains request header information for HTTP. More...
#include <qhttp.h>
Public Member Functions | |
int | majorVersion () const |
QString | method () const |
int | minorVersion () const |
QHttpRequestHeader & | operator= (const QHttpRequestHeader &header) |
QString | path () const |
QHttpRequestHeader () | |
QHttpRequestHeader (const QString &method, const QString &path, int majorVer=1, int minorVer=1) | |
QHttpRequestHeader (const QHttpRequestHeader &header) | |
QHttpRequestHeader (const QString &str) | |
void | setRequest (const QString &method, const QString &path, int majorVer=1, int minorVer=1) |
QString | toString () const |
Public Member Functions inherited from QHttpHeader | |
void | addValue (const QString &key, const QString &value) |
QStringList | allValues (const QString &key) const |
uint | contentLength () const |
QString | contentType () const |
bool | hasContentLength () const |
bool | hasContentType () const |
bool | hasKey (const QString &key) const |
bool | isValid () const |
QStringList | keys () const |
QHttpHeader & | operator= (const QHttpHeader &h) |
QHttpHeader () | |
QHttpHeader (const QHttpHeader &header) | |
QHttpHeader (const QString &str) | |
void | removeAllValues (const QString &key) |
void | removeValue (const QString &key) |
void | setContentLength (int len) |
void | setContentType (const QString &type) |
void | setValue (const QString &key, const QString &value) |
void | setValues (const QList< QPair< QString, QString >> &values) |
QString | value (const QString &key) const |
QList< QPair< QString, QString > > | values () const |
virtual | ~QHttpHeader () |
Protected Member Functions | |
bool | parseLine (const QString &line, int number) |
Protected Member Functions inherited from QHttpHeader | |
bool | parse (const QString &str) |
QHttpHeader (QHttpHeaderPrivate &dd, const QString &str=QString()) | |
QHttpHeader (QHttpHeaderPrivate &dd, const QHttpHeader &header) | |
void | setValid (bool) |
Additional Inherited Members | |
Protected Attributes inherited from QHttpHeader | |
QScopedPointer < QHttpHeaderPrivate > | d_ptr |
The QHttpRequestHeader class contains request header information for HTTP.
QtNetwork
This class is used in the QHttp class to report the header information if the client requests something from the server.
HTTP requests have a method which describes the request's action. The most common requests are "GET" and "POST". In addition to the request method the header also includes a request-URI to specify the location for the method to use.
The method, request-URI and protocol-version can be set using a constructor or later using setRequest(). The values can be obtained using method(), path(), majorVersion() and minorVersion().
Note that the request-URI must be in the format expected by the HTTP server. That is, all reserved characters must be encoded in HH (where HH are two hexadecimal digits). See QUrl::toPercentEncoding() for more information.
Important inherited functions: setValue() and value().
QHttpRequestHeader::QHttpRequestHeader | ( | ) |
Constructs an empty HTTP request header.
References QHttpHeader::setValid().
QHttpRequestHeader::QHttpRequestHeader | ( | const QString & | method, |
const QString & | path, | ||
int | majorVer = 1 , |
||
int | minorVer = 1 |
||
) |
QHttpRequestHeader::QHttpRequestHeader | ( | const QHttpRequestHeader & | header | ) |
Constructs a copy of header.
References d.
QHttpRequestHeader::QHttpRequestHeader | ( | const QString & | str | ) |
Constructs a HTTP request header from the string str. The str should consist of one or more "\r\n" delimited lines; the first line should be the request-line (format: method, space, request-URI, space HTTP-version); each of the remaining lines should have the format key, colon, space, value.
References QHttpHeader::parse().
|
virtual |
Returns the major protocol-version of the HTTP request header.
Implements QHttpHeader.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().
QString QHttpRequestHeader::method | ( | ) | const |
Returns the method of the HTTP request header.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest(), QHttpPrivate::addRequest(), QHttpRequestHeader(), and setRequest().
|
virtual |
Returns the minor protocol-version of the HTTP request header.
Implements QHttpHeader.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().
QHttpRequestHeader & QHttpRequestHeader::operator= | ( | const QHttpRequestHeader & | header | ) |
Copies the content of header into this QHttpRequestHeader
References d, and QHttpHeader::operator=().
|
protectedvirtual |
Reimplemented from QHttpHeader.
References d, QHttpHeader::parseLine(), and v.
QString QHttpRequestHeader::path | ( | ) | const |
Returns the request-URI of the HTTP request header.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest(), QHttpPrivate::addRequest(), QHttpRequestHeader(), and setRequest().
void QHttpRequestHeader::setRequest | ( | const QString & | method, |
const QString & | path, | ||
int | majorVer = 1 , |
||
int | minorVer = 1 |
||
) |
This function sets the request method to method, the request-URI to path and the protocol-version to majorVer and minorVer. The path argument must be properly encoded for an HTTP request.
References d, method(), path(), and QHttpHeader::setValid().
Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().
|
virtual |
Reimplemented from QHttpHeader.
References d, first(), and QHttpHeader::toString().
Referenced by QHttpPrivate::_q_slotConnected().