Qt 4.8
|
The QHttpRequestHeader class contains request header information for HTTP. More...
#include <qhttp.h>
Public Functions | |
int | majorVersion () const |
Returns the major protocol-version of the HTTP request header. More... | |
QString | method () const |
Returns the method of the HTTP request header. More... | |
int | minorVersion () const |
Returns the minor protocol-version of the HTTP request header. More... | |
QHttpRequestHeader & | operator= (const QHttpRequestHeader &header) |
Copies the content of header into this QHttpRequestHeader. More... | |
QString | path () const |
Returns the request-URI of the HTTP request header. More... | |
QHttpRequestHeader () | |
Constructs an empty HTTP request header. More... | |
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. More... | |
QHttpRequestHeader (const QHttpRequestHeader &header) | |
Constructs a copy of header. More... | |
QHttpRequestHeader (const QString &str) | |
Constructs a HTTP request header from the string str. More... | |
void | 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. More... | |
QString | toString () const |
Reimplemented Function More... | |
Public Functions inherited from QHttpHeader | |
void | addValue (const QString &key, const QString &value) |
Adds a new entry with the key and value. More... | |
QStringList | allValues (const QString &key) const |
Returns all the entries with the given key. More... | |
uint | contentLength () const |
Returns the value of the special HTTP header field content-length . More... | |
QString | contentType () const |
Returns the value of the special HTTP header field content-type . More... | |
bool | hasContentLength () const |
Returns true if the header has an entry for the special HTTP header field content-length ; otherwise returns false. More... | |
bool | hasContentType () const |
Returns true if the header has an entry for the special HTTP header field content-type ; otherwise returns false. More... | |
bool | hasKey (const QString &key) const |
Returns true if the HTTP header has an entry with the given key; otherwise returns false. More... | |
bool | isValid () const |
Returns true if the HTTP header is valid; otherwise returns false. More... | |
QStringList | keys () const |
Returns a list of the keys in the HTTP header. More... | |
QHttpHeader & | operator= (const QHttpHeader &h) |
Assigns h and returns a reference to this http header. More... | |
QHttpHeader () | |
Constructs an empty HTTP header. More... | |
QHttpHeader (const QHttpHeader &header) | |
Constructs a copy of header. More... | |
QHttpHeader (const QString &str) | |
Constructs a HTTP header for str. More... | |
void | removeAllValues (const QString &key) |
Removes all the entries with the key key from the HTTP header. More... | |
void | removeValue (const QString &key) |
Removes the entry with the key key from the HTTP header. More... | |
void | setContentLength (int len) |
Sets the value of the special HTTP header field content-length to len. More... | |
void | setContentType (const QString &type) |
Sets the value of the special HTTP header field content-type to type. More... | |
void | setValue (const QString &key, const QString &value) |
Sets the value of the entry with the key to value. More... | |
void | setValues (const QList< QPair< QString, QString > > &values) |
Sets the header entries to be the list of key value pairs in values. More... | |
QString | value (const QString &key) const |
Returns the first value for the entry with the given key. More... | |
QList< QPair< QString, QString > > | values () const |
Returns all the entries in the header. More... | |
virtual | ~QHttpHeader () |
Destructor. More... | |
Protected Functions | |
bool | parseLine (const QString &line, int number) |
Protected Functions inherited from QHttpHeader | |
bool | parse (const QString &str) |
Parses the HTTP header string str for header fields and adds the keys/values it finds. More... | |
QHttpHeader (QHttpHeaderPrivate &dd, const QString &str=QString()) | |
QHttpHeader (QHttpHeaderPrivate &dd, const QHttpHeader &header) | |
void | setValid (bool) |
Additional Inherited Members | |
Protected Variables inherited from QHttpHeader | |
QScopedPointer< QHttpHeaderPrivate > | d_ptr |
The QHttpRequestHeader class contains request header information for HTTP.
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.
Definition at line 1279 of file qhttp.cpp.
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.
Definition at line 1291 of file qhttp.cpp.
QHttpRequestHeader::QHttpRequestHeader | ( | const QHttpRequestHeader & | header | ) |
Constructs a copy of header.
Definition at line 1304 of file qhttp.cpp.
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.
Definition at line 1335 of file qhttp.cpp.
|
virtual |
Returns the major protocol-version of the HTTP request header.
Implements QHttpHeader.
Definition at line 1386 of file qhttp.cpp.
Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().
QString QHttpRequestHeader::method | ( | ) | const |
Returns the method of the HTTP request header.
Definition at line 1364 of file qhttp.cpp.
Referenced by QHttpPrivate::_q_slotSendRequest(), QHttpPrivate::addRequest(), QHttpRequestHeader(), and setRequest().
|
virtual |
Returns the minor protocol-version of the HTTP request header.
Implements QHttpHeader.
Definition at line 1397 of file qhttp.cpp.
Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().
QHttpRequestHeader & QHttpRequestHeader::operator= | ( | const QHttpRequestHeader & | header | ) |
Copies the content of header into this QHttpRequestHeader.
Definition at line 1317 of file qhttp.cpp.
|
protectedvirtual |
Reimplemented from QHttpHeader.
Definition at line 1405 of file qhttp.cpp.
QString QHttpRequestHeader::path | ( | ) | const |
Returns the request-URI of the HTTP request header.
Definition at line 1375 of file qhttp.cpp.
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.
Definition at line 1349 of file qhttp.cpp.
Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().
|
virtual |
Reimplemented Function
Reimplemented from QHttpHeader.
Definition at line 1433 of file qhttp.cpp.
Referenced by QHttpPrivate::_q_slotConnected().