12 #ifndef ENGINEREQUEST_H
13 #define ENGINEREQUEST_H
16 #include <QHostAddress>
17 #include <QElapsedTimer>
19 #include <Cutelyst/Headers>
32 FinalizedHeaders = 0x01,
39 Q_DECLARE_FLAGS(Status, StatusFlag)
49 virtual void finalizeBody();
57 virtual void finalizeError();
70 virtual void finalizeCookies();
77 virtual bool finalizeHeaders();
82 qint64 write(
const char *data, qint64 len);
84 bool webSocketHandshake(
const QString &key,
const QString &origin,
const QString &protocol);
86 virtual bool webSocketSendTextMessage(
const QString &message);
88 virtual bool webSocketSendBinaryMessage(
const QByteArray &message);
90 virtual bool webSocketSendPing(
const QByteArray &payload);
92 virtual bool webSocketClose(quint16 code,
const QString &reason);
98 virtual qint64
doWrite(
const char *data, qint64 len) = 0;
110 virtual void processingFinished();
117 virtual bool webSocketHandshakeDo(
const QString &key,
const QString &origin,
const QString &protocol);
126 void setPath(
char *rawPath,
const int len);
128 inline void setPath(
const QString &path) {
129 QByteArray rawPath = path.toLatin1();
130 setPath(rawPath.data(), rawPath.size());
159 quint64 startOfRequest = 0;
162 Status status = InitialState;
166 QIODevice *body =
nullptr;
173 quint16 remotePort = 0;
176 bool isSecure =
false;
184 Q_DECLARE_OPERATORS_FOR_FLAGS(Cutelyst::EngineRequest::Status)
virtual qint64 doWrite(const char *data, qint64 len)=0
Reimplement this to do the RAW writing to the client.
QString method
The method used (GET, POST...)
QString path
Call setPath() instead.
QByteArray query
The query string requested by the user agent 'foo=bar&baz'.
QHostAddress remoteAddress
The remote/client address.
QString remoteUser
The remote user name set by a front web server.
Headers headers
The request headers.
virtual bool writeHeaders(quint16 status, const Headers &headers)=0
Reimplement this to write the headers back to the client.
QString serverAddress
The server address which the server is listening to, usually the 'Host' header but if that's not pres...
QElapsedTimer elapsed
The elapsed timer since the start of request.
QString protocol
The protocol requested by the user agent 'HTTP1/1'.
The Cutelyst namespace holds all public Cutelyst API.