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

Public Types

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

Public Member Functions

 EngineRequest (Engine *_engine)
 
void finalize (Context *c)
 Called by Application to deal with finalizing cookies, headers and body.
 
virtual void finalizeBody (Context *c)
 Engines must reimplement this to write the response body back to the caller.
 
virtual void finalizeCookies (Context *c)
 Reimplement if you need a custom way to Set-Cookie, the default implementation writes them to c->res()->headers()
 
virtual void finalizeError (Context *c)
 Engines should overwrite this if they want to to make custom error messages. More...
 
virtual bool finalizeHeaders (Context *c)
 Finalize the headers, and call doWriteHeader(), reimplemententions must call this first.
 
virtual bool webSocketClose (quint16 code, const QString &reason)
 
bool webSocketHandshake (Context *c, 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.
 
Engineengine
 Pointer to parent Engine class.
 
Headers headers
 The request headers.
 
bool isSecure
 If the connection is secure HTTPS.
 
QString method
 The method used (GET, POST...)
 
QString path
 The path requested by the user agent '/index', MUST NOT have a leading slash.
 
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.
 
void * requestPtr
 The internal pointer of the request, to be used for mapping this request to the real request.
 
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 bool webSocketHandshakeDo (Context *c, 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.
 

Detailed Description

Definition at line 30 of file enginerequest.h.

Member Function Documentation

void EngineRequest::finalizeError ( Context c)
virtual

Default implementation render an html with errors.

Definition at line 71 of file enginerequest.cpp.

References body, Cutelyst::Context::errors(), Cutelyst::Context::response(), Cutelyst::Response::setBody(), Cutelyst::Response::setContentType(), and Cutelyst::Response::setStatus().

Referenced by finalize().