Cutelyst  2.5.0
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
Cutelyst::EngineRequest Class Referenceabstract

Public Types

enum  StatusFlag {
  InitialState, FinalizedHeaders, IOWrite, Chunked,
  ChunkedDone
}
 

Public Member Functions

void finalize ()
 Called by Application to deal with finalizing cookies, headers and body.
 
virtual void finalizeBody ()
 Engines must reimplement this to write the response body back to the caller.
 
virtual void finalizeCookies ()
 Reimplement if you need a custom way to Set-Cookie, the default implementation writes them to c->res()->headers()
 
virtual void finalizeError ()
 Engines should overwrite this if they want to to make custom error messages. More...
 
virtual bool finalizeHeaders ()
 Finalize the headers, and call doWriteHeader(), reimplemententions must call this first.
 
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. More...
 
void setPath (const QString &path)
 
virtual bool webSocketClose (quint16 code, const QString &reason)
 
bool webSocketHandshake (const QString &key, const QString &origin, const QString &protocol)
 
virtual bool webSocketSendBinaryMessage (const QByteArray &message)
 
virtual bool webSocketSendPing (const QByteArray &payload)
 
virtual bool webSocketSendTextMessage (const QString &message)
 
qint64 write (const char *data, qint64 len)
 Called by Response to manually write data.
 

Public Attributes

QIODevice * body
 The QIODevice containing the body (if any) of the request. More...
 
Contextcontext
 The Cutelyst::Context of this request. More...
 
Headers headers
 The request headers.
 
bool isSecure
 If the connection is secure HTTPS.
 
QString method
 The method used (GET, POST...)
 
QString path
 Call setPath() instead.
 
QString protocol
 The protocol requested by the user agent 'HTTP1/1'.
 
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.
 
QString serverAddress
 The server address which the server is listening to, usually the 'Host' header but if that's not present should be filled with the server address.
 
quint64 startOfRequest
 The timestamp of the start of headers.
 
Status status
 Connection status.
 

Protected Member Functions

virtual qint64 doWrite (const char *data, qint64 len)=0
 Reimplement this to do the RAW writing to the client.
 
virtual void processingFinished ()
 This is called when the Application chain is finished processing this request, here the request can send final bytes to the client or do a clean up. More...
 
virtual bool webSocketHandshakeDo (const QString &key, const QString &origin, const QString &protocol)
 
virtual bool writeHeaders (quint16 status, const Headers &headers)=0
 Reimplement this to write the headers back to the client.
 

Friends

class Engine
 

Detailed Description

Definition at line 30 of file enginerequest.h.

Member Function Documentation

◆ finalizeError()

void EngineRequest::finalizeError ( )
virtual

◆ processingFinished()

void EngineRequest::processingFinished ( )
protectedvirtual

Default implementation deletes both body and context.

If a WebSocket upgrade was made then you will want to keep the context object around.

Definition at line 196 of file enginerequest.cpp.

References protocol.

Referenced by Cutelyst::Engine::processRequest().

◆ setPath()

void EngineRequest::setPath ( char *  rawPath,
const int  len 
)

The path requested by the user agent '/index', MUST NOT have a leading slash

Definition at line 208 of file enginerequest.cpp.

References path.

Member Data Documentation

◆ body

QIODevice* Cutelyst::EngineRequest::body
Note
It's deleted on processingFinished() or destructor

Definition at line 169 of file enginerequest.h.

Referenced by finalizeBody(), and finalizeError().

◆ context

Context* Cutelyst::EngineRequest::context