Torc
0.1
|
A class to encapsulate an incoming HTTP request. More...
#include <torchttprequest.h>
Public Member Functions | |
TorcHTTPRequest (TorcHTTPReader *Reader) | |
void | SetConnection (HTTPConnection Connection) |
void | SetStatus (HTTPStatus Status) |
void | SetResponseType (HTTPResponseType Type) |
void | SetResponseContent (const QByteArray &Content) |
void | SetResponseFile (const QString &File) |
void | SetResponseHeader (const QString &Header, const QString &Value) |
void | SetAllowed (int Allowed) |
void | SetAllowGZip (bool Allowed) |
Allow gzip compression for the contents of this request. More... | |
void | SetAllowCORS (bool Allowed) |
void | SetCache (int Cache, const QString &Tag=QStringLiteral("")) |
Set the caching behaviour for this response. More... | |
void | SetSecure (bool Secure) |
bool | GetSecure (void) |
HTTPStatus | GetHTTPStatus (void) const |
HTTPType | GetHTTPType (void) const |
HTTPRequestType | GetHTTPRequestType (void) const |
HTTPProtocol | GetHTTPProtocol (void) const |
QString | GetUrl (void) const |
QString | GetPath (void) const |
QString | GetMethod (void) const |
QString | GetCache (void) const |
const QMap< QString, QString > & | Headers (void) const |
const QMap< QString, QString > & | Queries (void) const |
bool | GetAllowCORS (void) const |
void | Respond (QTcpSocket *Socket) |
void | Redirected (const QString &Redirected) |
void | Serialise (const QVariant &Data, const QString &Type) |
bool | Unmodified (const QDateTime &LastModified) |
Return true if the resource is unmodified. More... | |
bool | Unmodified (void) |
Check whether the resource is equivalent to the last seen version. More... | |
void | Authorise (HTTPAuthorisation Authorisation) |
HTTPAuthorisation | IsAuthorised (void) const |
Static Public Member Functions | |
static HTTPRequestType | RequestTypeFromString (const QString &Type) |
static QString | RequestTypeToString (HTTPRequestType Type) |
static HTTPProtocol | ProtocolFromString (const QString &Protocol) |
static HTTPStatus | StatusFromString (const QString &Status) |
static QString | ProtocolToString (HTTPProtocol Protocol) |
static QString | StatusToString (HTTPStatus Status) |
static QString | ResponseTypeToString (HTTPResponseType Response) |
static QString | AllowedToString (int Allowed) |
static QString | ConnectionToString (HTTPConnection Connection) |
static int | StringToAllowed (const QString &Allowed) |
static QVector< QPair< quint64, quint64 > > | StringToRanges (const QString &Ranges, qint64 Size, qint64 &SizeToSend) |
static QString | RangeToString (QPair< quint64, quint64 > Range, qint64 Size) |
Static Public Attributes | |
static char | DateFormat [] = "ddd, dd MMM yyyy HH:mm:ss 'UTC'" |
Protected Member Functions | |
~TorcHTTPRequest ()=default | |
void | Initialise (const QString &Method) |
Protected Attributes | |
QString | m_fullUrl |
QString | m_path |
QString | m_method |
QString | m_query |
QString | m_redirectedTo |
HTTPType | m_type |
HTTPRequestType | m_requestType |
HTTPProtocol | m_protocol |
HTTPConnection | m_connection |
QVector< QPair< quint64, quint64 > > | m_ranges |
QMap< QString, QString > | m_headers |
QMap< QString, QString > | m_queries |
QByteArray | m_content |
bool | m_secure |
bool | m_allowGZip |
bool | m_allowCORS |
int | m_allowed |
HTTPAuthorisation | m_authorised |
HTTPResponseType | m_responseType |
int | m_cache |
QString | m_cacheTag |
HTTPStatus | m_responseStatus |
QByteArray | m_responseContent |
QString | m_responseFile |
QMap< QString, QString > | m_responseHeaders |
Friends | |
class | TorcWebSocket |
A class to encapsulate an incoming HTTP request.
TorcHTTPRequest validates an incoming HTTP request and prepares the appropriate headers for the response.
Add support for multiple headers of the same type (e.g. Sec-WebSocket-Protocol).
Support gzip compression for range requests (if it is possible?)
Definition at line 112 of file torchttprequest.h.
|
explicit |
Definition at line 70 of file torchttprequest.cpp.
|
protecteddefault |
|
static |
Definition at line 875 of file torchttprequest.cpp.
void TorcHTTPRequest::Authorise | ( | HTTPAuthorisation | Authorisation | ) |
Definition at line 1097 of file torchttprequest.cpp.
|
static |
Definition at line 889 of file torchttprequest.cpp.
bool TorcHTTPRequest::GetAllowCORS | ( | void | ) | const |
Definition at line 231 of file torchttprequest.cpp.
QString TorcHTTPRequest::GetCache | ( | void | ) | const |
Definition at line 296 of file torchttprequest.cpp.
HTTPProtocol TorcHTTPRequest::GetHTTPProtocol | ( | void | ) | const |
Definition at line 276 of file torchttprequest.cpp.
HTTPRequestType TorcHTTPRequest::GetHTTPRequestType | ( | void | ) | const |
Definition at line 271 of file torchttprequest.cpp.
HTTPStatus TorcHTTPRequest::GetHTTPStatus | ( | void | ) | const |
Definition at line 261 of file torchttprequest.cpp.
HTTPType TorcHTTPRequest::GetHTTPType | ( | void | ) | const |
Definition at line 266 of file torchttprequest.cpp.
QString TorcHTTPRequest::GetMethod | ( | void | ) | const |
Definition at line 291 of file torchttprequest.cpp.
QString TorcHTTPRequest::GetPath | ( | void | ) | const |
Definition at line 286 of file torchttprequest.cpp.
bool TorcHTTPRequest::GetSecure | ( | void | ) |
Definition at line 256 of file torchttprequest.cpp.
QString TorcHTTPRequest::GetUrl | ( | void | ) | const |
Definition at line 281 of file torchttprequest.cpp.
const QMap< QString, QString > & TorcHTTPRequest::Headers | ( | void | ) | const |
Definition at line 301 of file torchttprequest.cpp.
|
protected |
Definition at line 108 of file torchttprequest.cpp.
HTTPAuthorisation TorcHTTPRequest::IsAuthorised | ( | void | ) | const |
Definition at line 1102 of file torchttprequest.cpp.
|
static |
Definition at line 780 of file torchttprequest.cpp.
|
static |
Definition at line 811 of file torchttprequest.cpp.
const QMap< QString, QString > & TorcHTTPRequest::Queries | ( | void | ) | const |
Definition at line 306 of file torchttprequest.cpp.
|
static |
Definition at line 1038 of file torchttprequest.cpp.
void TorcHTTPRequest::Redirected | ( | const QString & | Redirected | ) |
Definition at line 743 of file torchttprequest.cpp.
|
static |
Definition at line 750 of file torchttprequest.cpp.
|
static |
Definition at line 762 of file torchttprequest.cpp.
void TorcHTTPRequest::Respond | ( | QTcpSocket * | Socket | ) |
Definition at line 311 of file torchttprequest.cpp.
|
static |
Definition at line 850 of file torchttprequest.cpp.
void TorcHTTPRequest::Serialise | ( | const QVariant & | Data, |
const QString & | Type | ||
) |
Definition at line 1043 of file torchttprequest.cpp.
void TorcHTTPRequest::SetAllowCORS | ( | bool | Allowed | ) |
Definition at line 226 of file torchttprequest.cpp.
void TorcHTTPRequest::SetAllowed | ( | int | Allowed | ) |
Definition at line 215 of file torchttprequest.cpp.
void TorcHTTPRequest::SetAllowGZip | ( | bool | Allowed | ) |
Allow gzip compression for the contents of this request.
Definition at line 221 of file torchttprequest.cpp.
void TorcHTTPRequest::SetCache | ( | int | Cache, |
const QString & | Tag = QStringLiteral("") |
||
) |
Set the caching behaviour for this response.
The default behaviour is to to try and enforce no caching. Standard caching can be enabled with HTTPCacheShortLife or HTTPCacheLongLife with optional use of 'last modified' or ETag for conditional requests. The 'last-modified' and 'ETag' fields are set with the Tag parameter.
Definition at line 245 of file torchttprequest.cpp.
void TorcHTTPRequest::SetConnection | ( | HTTPConnection | Connection | ) |
Definition at line 183 of file torchttprequest.cpp.
void TorcHTTPRequest::SetResponseContent | ( | const QByteArray & | Content | ) |
Definition at line 198 of file torchttprequest.cpp.
void TorcHTTPRequest::SetResponseFile | ( | const QString & | File | ) |
Definition at line 204 of file torchttprequest.cpp.
void TorcHTTPRequest::SetResponseHeader | ( | const QString & | Header, |
const QString & | Value | ||
) |
Definition at line 210 of file torchttprequest.cpp.
void TorcHTTPRequest::SetResponseType | ( | HTTPResponseType | Type | ) |
Definition at line 193 of file torchttprequest.cpp.
void TorcHTTPRequest::SetSecure | ( | bool | Secure | ) |
Definition at line 251 of file torchttprequest.cpp.
void TorcHTTPRequest::SetStatus | ( | HTTPStatus | Status | ) |
Definition at line 188 of file torchttprequest.cpp.
|
static |
Definition at line 792 of file torchttprequest.cpp.
|
static |
Definition at line 824 of file torchttprequest.cpp.
|
static |
Definition at line 901 of file torchttprequest.cpp.
|
static |
Definition at line 916 of file torchttprequest.cpp.
bool TorcHTTPRequest::Unmodified | ( | const QDateTime & | LastModified | ) |
Return true if the resource is unmodified.
The client must have supplied the 'If-Modified-Since' header and the request must have last-modified caching enabled.
Definition at line 1057 of file torchttprequest.cpp.
bool TorcHTTPRequest::Unmodified | ( | void | ) |
Check whether the resource is equivalent to the last seen version.
This method validates the ETag header, which must have been set locally and the client must have sent the 'If-None-Match' header.
Definition at line 1082 of file torchttprequest.cpp.
|
friend |
Definition at line 114 of file torchttprequest.h.
|
static |
Definition at line 130 of file torchttprequest.h.
|
protected |
Definition at line 187 of file torchttprequest.h.
|
protected |
Definition at line 188 of file torchttprequest.h.
|
protected |
Definition at line 186 of file torchttprequest.h.
|
protected |
Definition at line 189 of file torchttprequest.h.
|
protected |
Definition at line 191 of file torchttprequest.h.
|
protected |
Definition at line 192 of file torchttprequest.h.
|
protected |
Definition at line 179 of file torchttprequest.h.
|
protected |
Definition at line 183 of file torchttprequest.h.
|
protected |
Definition at line 171 of file torchttprequest.h.
|
protected |
Definition at line 181 of file torchttprequest.h.
|
protected |
Definition at line 173 of file torchttprequest.h.
|
protected |
Definition at line 172 of file torchttprequest.h.
|
protected |
Definition at line 178 of file torchttprequest.h.
|
protected |
Definition at line 182 of file torchttprequest.h.
|
protected |
Definition at line 174 of file torchttprequest.h.
|
protected |
Definition at line 180 of file torchttprequest.h.
|
protected |
Definition at line 175 of file torchttprequest.h.
|
protected |
Definition at line 177 of file torchttprequest.h.
|
protected |
Definition at line 194 of file torchttprequest.h.
|
protected |
Definition at line 195 of file torchttprequest.h.
|
protected |
Definition at line 196 of file torchttprequest.h.
|
protected |
Definition at line 193 of file torchttprequest.h.
|
protected |
Definition at line 190 of file torchttprequest.h.
|
protected |
Definition at line 184 of file torchttprequest.h.
|
protected |
Definition at line 176 of file torchttprequest.h.