#include <qhttp.h>
Inheritance diagram for QHttpRequestHeader:


network
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().
Important inherited functions: setValue() and value().
Definition at line 122 of file qhttp.h.
Public Member Functions | |
| QHttpRequestHeader () | |
| QHttpRequestHeader (const QString &method, const QString &path, int majorVer=1, int minorVer=1) | |
| QHttpRequestHeader (const QHttpRequestHeader &header) | |
| QHttpRequestHeader (const QString &str) | |
| QHttpRequestHeader & | operator= (const QHttpRequestHeader &header) |
| void | setRequest (const QString &method, const QString &path, int majorVer=1, int minorVer=1) |
| QString | method () const |
| QString | path () const |
| int | majorVersion () const |
| int | minorVersion () const |
| QString | toString () const |
Protected Member Functions | |
| bool | parseLine (const QString &line, int number) |
| QHttpRequestHeader::QHttpRequestHeader | ( | ) |
Constructs an empty HTTP request header.
Definition at line 1197 of file qhttp.cpp.
References QHttpHeader::setValid().
01198 : QHttpHeader(*new QHttpRequestHeaderPrivate) 01199 { 01200 setValid(false); 01201 }
Here is the call graph for this function:

| 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.
Definition at line 1207 of file qhttp.cpp.
References d, method(), and path().
01208 : QHttpHeader(*new QHttpRequestHeaderPrivate) 01209 { 01210 Q_D(QHttpRequestHeader); 01211 d->m = method; 01212 d->p = path; 01213 d->majVer = majorVer; 01214 d->minVer = minorVer; 01215 }
Here is the call graph for this function:

| QHttpRequestHeader::QHttpRequestHeader | ( | const QHttpRequestHeader & | header | ) |
Constructs a copy of header.
Definition at line 1220 of file qhttp.cpp.
01221 : QHttpHeader(*new QHttpRequestHeaderPrivate, header) 01222 { 01223 Q_D(QHttpRequestHeader); 01224 d->m = header.d_func()->m; 01225 d->p = header.d_func()->p; 01226 d->majVer = header.d_func()->majVer; 01227 d->minVer = header.d_func()->minVer; 01228 }
Here is the call graph for this function:

| 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 1251 of file qhttp.cpp.
References QHttpHeader::parse().
01252 : QHttpHeader(*new QHttpRequestHeaderPrivate) 01253 { 01254 parse(str); 01255 }
Here is the call graph for this function:

| QHttpRequestHeader & QHttpRequestHeader::operator= | ( | const QHttpRequestHeader & | header | ) |
Copies the content of header into this QHttpRequestHeader
Definition at line 1233 of file qhttp.cpp.
References d, header(), and QHttpHeader::operator=().
01234 { 01235 Q_D(QHttpRequestHeader); 01236 QHttpHeader::operator=(header); 01237 d->m = header.d_func()->m; 01238 d->p = header.d_func()->p; 01239 d->majVer = header.d_func()->majVer; 01240 d->minVer = header.d_func()->minVer; 01241 return *this; 01242 }
Here is the call graph for this function:

| 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.
Definition at line 1264 of file qhttp.cpp.
References d, method(), path(), and QHttpHeader::setValid().
Referenced by QHttpPrivate::_q_slotSendRequest().
01265 { 01266 Q_D(QHttpRequestHeader); 01267 setValid(true); 01268 d->m = method; 01269 d->p = path; 01270 d->majVer = majorVer; 01271 d->minVer = minorVer; 01272 }
Here is the call graph for this function:

| QString QHttpRequestHeader::method | ( | ) | const |
Returns the method of the HTTP request header.
Definition at line 1279 of file qhttp.cpp.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest(), QHttpRequestHeader(), and setRequest().
01280 { 01281 Q_D(const QHttpRequestHeader); 01282 return d->m; 01283 }
| QString QHttpRequestHeader::path | ( | ) | const |
Returns the request-URI of the HTTP request header.
Definition at line 1290 of file qhttp.cpp.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest(), QHttpRequestHeader(), and setRequest().
01291 { 01292 Q_D(const QHttpRequestHeader); 01293 return d->p; 01294 }
| int QHttpRequestHeader::majorVersion | ( | ) | const [virtual] |
Returns the major protocol-version of the HTTP request header.
Implements QHttpHeader.
Definition at line 1301 of file qhttp.cpp.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest().
01302 { 01303 Q_D(const QHttpRequestHeader); 01304 return d->majVer; 01305 }
| int QHttpRequestHeader::minorVersion | ( | ) | const [virtual] |
Returns the minor protocol-version of the HTTP request header.
Implements QHttpHeader.
Definition at line 1312 of file qhttp.cpp.
References d.
Referenced by QHttpPrivate::_q_slotSendRequest().
01313 { 01314 Q_D(const QHttpRequestHeader); 01315 return d->minVer; 01316 }
| QString QHttpRequestHeader::toString | ( | ) | const [virtual] |
Reimplemented from QHttpHeader.
Definition at line 1348 of file qhttp.cpp.
References QString::arg(), d, and QHttpHeader::toString().
Referenced by QHttpPrivate::_q_slotConnected().
01349 { 01350 Q_D(const QHttpRequestHeader); 01351 QString first(QLatin1String("%1 %2")); 01352 QString last(QLatin1String(" HTTP/%3.%4\r\n%5\r\n")); 01353 return first.arg(d->m).arg(d->p) + 01354 last.arg(d->majVer).arg(d->minVer).arg(QHttpHeader::toString()); 01355 }
Here is the call graph for this function:

| bool QHttpRequestHeader::parseLine | ( | const QString & | line, | |
| int | number | |||
| ) | [protected, virtual] |
Reimplemented from QHttpHeader.
Definition at line 1320 of file qhttp.cpp.
References QList< T >::count(), d, QHttpHeader::parseLine(), QString::simplified(), and QString::split().
01321 { 01322 Q_D(QHttpRequestHeader); 01323 if (number != 0) 01324 return QHttpHeader::parseLine(line, number); 01325 01326 QStringList lst = line.simplified().split(QLatin1String(" ")); 01327 if (lst.count() > 0) { 01328 d->m = lst[0]; 01329 if (lst.count() > 1) { 01330 d->p = lst[1]; 01331 if (lst.count() > 2) { 01332 QString v = lst[2]; 01333 if (v.length() >= 8 && v.left(5) == QLatin1String("HTTP/") && 01334 v[5].isDigit() && v[6] == QLatin1Char('.') && v[7].isDigit()) { 01335 d->majVer = v[5].toLatin1() - '0'; 01336 d->minVer = v[7].toLatin1() - '0'; 01337 return true; 01338 } 01339 } 01340 } 01341 } 01342 01343 return false; 01344 }
Here is the call graph for this function:

1.5.1