Qt 4.8
|
The QHttpResponseHeader class contains response header information for HTTP. More...
#include <qhttp.h>
Public Functions | |
int | majorVersion () const |
Returns the major protocol-version of the HTTP response header. More... | |
int | minorVersion () const |
Returns the minor protocol-version of the HTTP response header. More... | |
QHttpResponseHeader & | operator= (const QHttpResponseHeader &header) |
Copies the contents of header into this QHttpResponseHeader. More... | |
QHttpResponseHeader () | |
Constructs an empty HTTP response header. More... | |
QHttpResponseHeader (const QHttpResponseHeader &header) | |
Constructs a copy of header. More... | |
QHttpResponseHeader (const QString &str) | |
Constructs a HTTP response header from the string str. More... | |
QHttpResponseHeader (int code, const QString &text=QString(), int majorVer=1, int minorVer=1) | |
Constructs a QHttpResponseHeader, setting the status code to code, the reason phrase to text and the protocol-version to majorVer and minorVer. More... | |
QString | reasonPhrase () const |
Returns the reason phrase of the HTTP response header. More... | |
void | setStatusLine (int code, const QString &text=QString(), int majorVer=1, int minorVer=1) |
Sets the status code to code, the reason phrase to text and the protocol-version to majorVer and minorVer. More... | |
int | statusCode () const |
Returns the status code of the HTTP response header. 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) |
Friends | |
class | QHttpPrivate |
Additional Inherited Members | |
Protected Variables inherited from QHttpHeader | |
QScopedPointer< QHttpHeaderPrivate > | d_ptr |
The QHttpResponseHeader class contains response header information for HTTP.
This class is used by the QHttp class to report the header information that the client received from the server.
HTTP responses have a status code that indicates the status of the response. This code is a 3-digit integer result code (for details see to RFC 1945). In addition to the status code, you can also specify a human-readable text that describes the reason for the code ("reason phrase"). This class allows you to get the status code and the reason phrase.
QHttpResponseHeader::QHttpResponseHeader | ( | ) |
Constructs an empty HTTP response header.
Definition at line 1055 of file qhttp.cpp.
QHttpResponseHeader::QHttpResponseHeader | ( | const QHttpResponseHeader & | header | ) |
Constructs a copy of header.
Definition at line 1064 of file qhttp.cpp.
QHttpResponseHeader::QHttpResponseHeader | ( | const QString & | str | ) |
Constructs a HTTP response header from the string str.
The string is parsed and the information is set. The str should consist of one or more "\r\n" delimited lines; the first line should be the status-line (format: HTTP-version, space, status-code, space, reason-phrase); each of remaining lines should have the format key, colon, space, value.
Definition at line 1096 of file qhttp.cpp.
QHttpResponseHeader::QHttpResponseHeader | ( | int | code, |
const QString & | text = QString() , |
||
int | majorVer = 1 , |
||
int | minorVer = 1 |
||
) |
Constructs a QHttpResponseHeader, setting the status code to code, the reason phrase to text and the protocol-version to majorVer and minorVer.
Definition at line 1114 of file qhttp.cpp.
|
virtual |
Returns the major protocol-version of the HTTP response header.
Implements QHttpHeader.
Definition at line 1168 of file qhttp.cpp.
Referenced by QHttpSocketEngine::slotSocketReadNotification().
|
virtual |
Returns the minor protocol-version of the HTTP response header.
Implements QHttpHeader.
Definition at line 1179 of file qhttp.cpp.
Referenced by QHttpSocketEngine::slotSocketReadNotification().
QHttpResponseHeader & QHttpResponseHeader::operator= | ( | const QHttpResponseHeader & | header | ) |
Copies the contents of header into this QHttpResponseHeader.
Definition at line 1077 of file qhttp.cpp.
|
protectedvirtual |
Reimplemented from QHttpHeader.
Definition at line 1187 of file qhttp.cpp.
QString QHttpResponseHeader::reasonPhrase | ( | ) | const |
Returns the reason phrase of the HTTP response header.
Definition at line 1157 of file qhttp.cpp.
void QHttpResponseHeader::setStatusLine | ( | int | code, |
const QString & | text = QString() , |
||
int | majorVer = 1 , |
||
int | minorVer = 1 |
||
) |
Sets the status code to code, the reason phrase to text and the protocol-version to majorVer and minorVer.
Definition at line 1131 of file qhttp.cpp.
Referenced by QHttpResponseHeader().
int QHttpResponseHeader::statusCode | ( | ) | const |
Returns the status code of the HTTP response header.
Definition at line 1146 of file qhttp.cpp.
Referenced by QHttpPrivate::_q_slotReadyRead(), and QHttpSocketEngine::slotSocketReadNotification().
|
virtual |
Reimplemented Function
Reimplemented from QHttpHeader.
Definition at line 1219 of file qhttp.cpp.
Referenced by QHttpPrivate::_q_slotReadyRead().
|
friend |