1 #ifndef TORCHTTPREQUEST_H 2 #define TORCHTTPREQUEST_H 110 #define READ_CHUNK_SIZE (1024 *64) 127 static QVector<QPair<quint64,quint64> >
StringToRanges (
const QString &Ranges, qint64 Size, qint64& SizeToSend);
128 static QString
RangeToString (QPair<quint64,quint64> Range, qint64 Size);
144 void SetCache (
int Cache,
const QString &Tag = QStringLiteral(
""));
151 QString
GetUrl (
void)
const;
155 const QMap<QString,QString>&
Headers (
void)
const;
156 const QMap<QString,QString>&
Queries (
void)
const;
158 void Respond (QTcpSocket *Socket);
160 void Serialise (
const QVariant &Data,
const QString &Type);
161 bool Unmodified (
const QDateTime &LastModified);
199 #endif // TORCHTTPREQUEST_H void SetAllowed(int Allowed)
bool GetAllowCORS(void) const
A class to encapsulate an incoming HTTP request.
QMap< QString, QString > m_queries
HTTPRequestType GetHTTPRequestType(void) const
QByteArray m_responseContent
static QString RequestTypeToString(HTTPRequestType Type)
Overlays the Websocket protocol over a QTcpSocket.
QString GetCache(void) const
void SetConnection(HTTPConnection Connection)
A convenience class to read HTTP requests from a QTcpSocket.
HTTPStatus m_responseStatus
HTTPStatus GetHTTPStatus(void) const
static QString ResponseTypeToString(HTTPResponseType Response)
static QString StatusToString(HTTPStatus Status)
void Initialise(const QString &Method)
HTTPRequestType m_requestType
void SetAllowCORS(bool Allowed)
HTTPAuthorisation IsAuthorised(void) const
bool Unmodified(void)
Check whether the resource is equivalent to the last seen version.
void Serialise(const QVariant &Data, const QString &Type)
static HTTPRequestType RequestTypeFromString(const QString &Type)
QString GetPath(void) const
const QMap< QString, QString > & Headers(void) const
void SetCache(int Cache, const QString &Tag=QStringLiteral(""))
Set the caching behaviour for this response.
void SetResponseContent(const QByteArray &Content)
QString GetMethod(void) const
void SetAllowGZip(bool Allowed)
Allow gzip compression for the contents of this request.
QMap< QString, QString > m_headers
TorcHTTPRequest(TorcHTTPReader *Reader)
void SetResponseHeader(const QString &Header, const QString &Value)
static QVector< QPair< quint64, quint64 > > StringToRanges(const QString &Ranges, qint64 Size, qint64 &SizeToSend)
HTTPAuthorisation m_authorised
static QString ProtocolToString(HTTPProtocol Protocol)
void Redirected(const QString &Redirected)
static int StringToAllowed(const QString &Allowed)
void SetSecure(bool Secure)
void SetStatus(HTTPStatus Status)
static HTTPProtocol ProtocolFromString(const QString &Protocol)
static QString RangeToString(QPair< quint64, quint64 > Range, qint64 Size)
void SetResponseFile(const QString &File)
void SetResponseType(HTTPResponseType Type)
QString GetUrl(void) const
QVector< QPair< quint64, quint64 > > m_ranges
static HTTPStatus StatusFromString(const QString &Status)
static QString ConnectionToString(HTTPConnection Connection)
HTTPProtocol GetHTTPProtocol(void) const
HTTPConnection m_connection
QMap< QString, QString > m_responseHeaders
HTTPType GetHTTPType(void) const
const QMap< QString, QString > & Queries(void) const
void Authorise(HTTPAuthorisation Authorisation)
~TorcHTTPRequest()=default
static QString AllowedToString(int Allowed)
HTTPResponseType m_responseType
void Respond(QTcpSocket *Socket)