12#ifndef ENGINEREQUEST_H
13#define ENGINEREQUEST_H
15#include <Cutelyst/Headers>
17#include <QElapsedTimer>
18#include <QHostAddress>
25class CUTELYST_LIBRARY EngineRequest
33 FinalizedHeaders = 0x01,
40 Q_DECLARE_FLAGS(Status, StatusFlag)
42 explicit EngineRequest();
44 virtual ~EngineRequest();
83 qint64
write(
const char *data, qint64 len);
87 virtual bool webSocketSendTextMessage(
const QString &message);
89 virtual bool webSocketSendBinaryMessage(
const QByteArray &message);
91 virtual bool webSocketSendPing(
const QByteArray &payload);
93 virtual bool webSocketClose(quint16 code,
const QString &reason);
99 virtual qint64
doWrite(
const char *data, qint64 len) = 0;
128 void setPath(
char *rawPath,
const int len);
188Q_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.
Context * context
The Cutelyst::Context of this request.
QString method
The method used (GET, POST...).
quint64 startOfRequest
The timestamp of the start of request, TODO remove in Cutelyst 3.
virtual void finalizeBody()
Engines must reimplement this to write the response body back to the caller.
bool isSecure
If the connection is secure HTTPS.
virtual void finalizeError()
Engines should overwrite this if they want to to make custom error messages.
QString path
Call setPath() instead.
Status status
Connection status.
void finalize()
Called by Application to deal with finalizing cookies, headers and body.
qint64 write(const char *data, qint64 len)
Called by Response to manually write data.
void setPath(char *rawPath, const int len)
This method sets the path and already does the decoding so that it is done a single time.
QByteArray query
The query string requested by the user agent 'foo=bar&baz'.
QHostAddress remoteAddress
The remote/client address.
quint16 remotePort
The remote/client port.
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...
virtual bool finalizeHeaders()
Finalize the headers, and call doWriteHeader(), reimplemententions must call this first.
virtual void finalizeCookies()
Reimplement if you need a custom way to Set-Cookie, the default implementation writes them to c->res(...
QElapsedTimer elapsed
The elapsed timer since the start of request.
QIODevice * body
The QIODevice containing the body (if any) of the request.
QString protocol
The protocol requested by the user agent 'HTTP1/1'.
virtual void processingFinished()
This is called when the Application chain is finished processing this request, here the request can s...
The Cutelyst namespace holds all public Cutelyst API.