CopperSpice API
1.9.2
|
Contains request header information for HTTP. More...
Inherits QHttpHeader
Public Methods | |
QHttpRequestHeader () | |
QHttpRequestHeader (const QHttpRequestHeader &other) | |
QHttpRequestHeader (const QString &method, const QString &path, int majorVer=1, int minorVer=1) | |
QHttpRequestHeader (const QString &str) | |
int | majorVersion () const override |
QString | method () const |
int | minorVersion () const override |
QHttpRequestHeader & | operator= (const QHttpRequestHeader &other) |
QString | path () const |
void | setRequest (const QString &method, const QString &path, int majorVer=1, int minorVer=1) |
QString | toString () const override |
The QHttpRequestHeader class contains request header information for HTTP. 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 HTTP 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().
The request-URI must be in the format expected by the HTTP server. All reserved characters must be encoded in HH (where HH are two hexadecimal digits). See QUrl::toPercentEncoding() for more information.
QHttpRequestHeader::QHttpRequestHeader | ( | ) |
Constructs an empty HTTP request header.
QHttpRequestHeader::QHttpRequestHeader | ( | const QString & | method, |
const QString & | path, | ||
int | majorVer = 1 , |
||
int | minorVer = 1 |
||
) |
Constructs an HTTP request header for the given method, the request URI path and the protocol version majorVer and minorVer. The path argument must be properly encoded for an HTTP request.
QHttpRequestHeader::QHttpRequestHeader | ( | const QHttpRequestHeader & | other | ) |
Copy constructs from other.
QHttpRequestHeader::QHttpRequestHeader | ( | const QString & | str | ) |
Constructs a HTTP request header from the string str. The string should consist of one or more lines separated by a carriage return or line feed.
The first line should be the request-line (format: method, space, request-URI, space HTTP-version) and each of the remaining lines should have the format key, colon, space, value.
|
override |
Returns the major protocol-version of the HTTP request header.
QString QHttpRequestHeader::method | ( | ) | const |
Returns the method of the HTTP request header.
|
override |
Returns the minor protocol-version of the HTTP request header.
QHttpRequestHeader & QHttpRequestHeader::operator= | ( | const QHttpRequestHeader & | other | ) |
Copy assigns from other and returns a reference to this object.
QString QHttpRequestHeader::path | ( | ) | const |
Returns the request-URI of the HTTP request header.
void QHttpRequestHeader::setRequest | ( | const QString & | method, |
const QString & | path, | ||
int | majorVer = 1 , |
||
int | minorVer = 1 |
||
) |
This method 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.
|
override |
Returns the HTTP response header as a string.