14#include <Cutelyst/Headers>
17#include <QElapsedTimer>
18#include <QHostAddress>
23using TimePointSteady = std::chrono::time_point<std::chrono::steady_clock>;
33 enum StatusFlag : quint8 {
35 FinalizedHeaders = 0x01,
42 Q_DECLARE_FLAGS(Status, StatusFlag)
52 virtual void finalizeBody();
60 virtual void finalizeError();
73 virtual void finalizeCookies();
80 virtual bool finalizeHeaders();
85 qint64 write(
const char *data, qint64 len);
87 bool webSocketHandshake(
const QByteArray &key,
88 const QByteArray &origin,
89 const QByteArray &protocol);
91 virtual bool webSocketSendTextMessage(
const QString &message);
93 virtual bool webSocketSendBinaryMessage(
const QByteArray &message);
95 virtual bool webSocketSendPing(
const QByteArray &payload);
97 virtual bool webSocketClose(quint16 code,
const QString &reason);
103 virtual qint64
doWrite(
const char *data, qint64 len) = 0;
115 virtual void processingFinished();
122 virtual bool webSocketHandshakeDo(
const QByteArray &key,
123 const QByteArray &origin,
124 const QByteArray &protocol);
133 void setPath(
char *rawPath,
const int len);
135 inline void setPath(QByteArray &path)
137 Q_ASSERT_X(path.startsWith(
'/'),
"leading slash",
"Path must always start with /");
138 setPath(path.data(), path.size());
169 QIODevice *body =
nullptr;
179 quint16 remotePort = 0;
182 Status status = InitialState;
185 bool isSecure =
false;
190Q_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 path
Call setPath() instead.
QByteArray query
The query string requested by the user agent 'foo=bar&baz'.
QHostAddress remoteAddress
The remote/client address.
QByteArray protocol
The protocol requested by the user agent 'HTTP1/1'.
QString remoteUser
The remote user name set by a front web server.
TimePointSteady startOfRequest
The timepoint of the start of request.
QByteArray method
The method used (GET, POST...)
QByteArray serverAddress
The server address which the server is listening to, usually the 'Host' header but if that's not pres...
Headers headers
The request headers.
virtual bool writeHeaders(quint16 status, const Headers &headers)=0
Reimplement this to write the headers back to the client.
The Cutelyst namespace holds all public Cutelyst API.