![]() |
KVIrc 5.2.6
Developer APIs
|
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 QHttpRequestHeader &header) | |
QHttpRequestHeader (const QString &method, const QString &path, int majorVer=1, int minorVer=1) | |
QHttpRequestHeader (const QString &str) | |
void | setRequest (const QString &method, const QString &path, int majorVer=1, int minorVer=1) |
QString | toString () const |
![]() | |
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) |
![]() | |
bool | parse (const QString &str) |
QHttpHeader (QHttpHeaderPrivate &dd, const QHttpHeader &header) | |
QHttpHeader (QHttpHeaderPrivate &dd, const QString &str=QString()) | |
void | setValid (bool) |
Additional Inherited Members | |
![]() | |
QScopedPointer< QHttpHeaderPrivate > | d_ptr |
The QHttpRequestHeader class contains request header information for HTTP.
\obsolete
\inmodule 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::QHttpHeader(), and QHttpHeader::setValid().
Referenced by majorVersion(), method(), minorVersion(), operator=(), parseLine(), path(), QHttpRequestHeader(), QHttpRequestHeader(), setRequest(), and toString().
QHttpRequestHeader::QHttpRequestHeader | ( | const QString & | method, |
const QString & | path, | ||
int | majorVer = 1, | ||
int | minorVer = 1 ) |
Constructs a HTTP request header for the method method, the request-URI path and the protocol-version majorVer and minorVer. The path argument must be properly encoded for an HTTP request.
References d, method(), path(), QHttpHeader::QHttpHeader(), and QHttpRequestHeader().
QHttpRequestHeader::QHttpRequestHeader | ( | const QHttpRequestHeader & | header | ) |
Constructs a copy of header.
References d, QHttpHeader::QHttpHeader(), and QHttpRequestHeader().
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(), and QHttpHeader::QHttpHeader().
|
virtual |
Returns the major protocol-version of the HTTP request header.
Implements QHttpHeader.
References d, and QHttpRequestHeader().
QString QHttpRequestHeader::method | ( | ) | const |
Returns the method of the HTTP request header.
References d, and QHttpRequestHeader().
Referenced by QHttpRequestHeader(), and setRequest().
|
virtual |
Returns the minor protocol-version of the HTTP request header.
Implements QHttpHeader.
References d, and QHttpRequestHeader().
QHttpRequestHeader & QHttpRequestHeader::operator= | ( | const QHttpRequestHeader & | header | ) |
Copies the content of header into this QHttpRequestHeader
References d, QHttpHeader::operator=(), and QHttpRequestHeader().
|
protectedvirtual |
Reimplemented from QHttpHeader.
References d, QHttpHeader::parseLine(), QHttpRequestHeader(), and v.
QString QHttpRequestHeader::path | ( | ) | const |
Returns the request-URI of the HTTP request header.
References d, and QHttpRequestHeader().
Referenced by 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(), QHttpRequestHeader(), and QHttpHeader::setValid().
|
virtual |
\reimp
Reimplemented from QHttpHeader.
References d, first(), QHttpRequestHeader(), and QHttpHeader::toString().