|
cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
Public Types | |
| enum | StatusFlag { InitialState , FinalizedHeaders , IOWrite , Chunked , ChunkedDone , Async , Finalized } |
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. | |
| 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. | |
| 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. | |
| Context * | context |
| The Cutelyst::Context of this request. | |
| QElapsedTimer | elapsed |
| The elapsed timer since the start of request. | |
| 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 request, TODO remove in Cutelyst 3. | |
| 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. | |
| 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 |
Definition at line 25 of file enginerequest.h.
| enum Cutelyst::EngineRequest::StatusFlag |
Definition at line 31 of file enginerequest.h.
|
explicit |
Definition at line 17 of file enginerequest.cpp.
|
virtual |
Definition at line 21 of file enginerequest.cpp.
| void EngineRequest::finalize | ( | ) |
Definition at line 79 of file enginerequest.cpp.
References context, finalizeBody(), finalizeError(), finalizeHeaders(), processingFinished(), and status.
|
virtual |
Definition at line 26 of file enginerequest.cpp.
References body, Cutelyst::Response::body(), Cutelyst::Response::bodyDevice(), QByteArray::constData(), context, doWrite(), QByteArray::size(), status, and write().
Referenced by finalize().
|
virtual |
Definition at line 93 of file enginerequest.cpp.
References context, Cutelyst::Response::cookies(), QString::fromLatin1(), headers, and Cutelyst::Response::headers().
Referenced by finalizeHeaders().
|
virtual |
Default implementation render an html with errors.
Definition at line 59 of file enginerequest.cpp.
References body, context, Cutelyst::Response::setBody(), Cutelyst::Response::setContentType(), and Cutelyst::Response::setStatus().
Referenced by finalize().
|
virtual |
Definition at line 109 of file enginerequest.cpp.
References context, finalizeCookies(), headers, Cutelyst::Response::headers(), Cutelyst::Response::size(), status, Cutelyst::Response::status(), and writeHeaders().
Referenced by finalize().
|
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 195 of file enginerequest.cpp.
Referenced by doWrite(), and finalize().
| 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 209 of file enginerequest.cpp.
References QString::fromLatin1(), QString::fromUtf8(), and path.
Referenced by writeHeaders().
|
inline |
Definition at line 130 of file enginerequest.h.
|
virtual |
Definition at line 188 of file enginerequest.cpp.
| bool EngineRequest::webSocketHandshake | ( | const QString & | key, |
| const QString & | origin, | ||
| const QString & | protocol ) |
Definition at line 151 of file enginerequest.cpp.
|
protectedvirtual |
Definition at line 199 of file enginerequest.cpp.
|
virtual |
Definition at line 176 of file enginerequest.cpp.
|
virtual |
Definition at line 182 of file enginerequest.cpp.
|
virtual |
Definition at line 170 of file enginerequest.cpp.
| qint64 EngineRequest::write | ( | const char * | data, |
| qint64 | len ) |
Definition at line 129 of file enginerequest.cpp.
References QByteArray::append(), QByteArray::data(), doWrite(), QByteArray::number(), QByteArray::reserve(), QByteArray::size(), status, and QByteArray::toUpper().
Referenced by finalizeBody().
|
friend |
Definition at line 28 of file enginerequest.h.
| QIODevice* Cutelyst::EngineRequest::body |
Definition at line 170 of file enginerequest.h.
Referenced by Cutelyst::Request::Request(), finalizeBody(), and finalizeError().
| Context* Cutelyst::EngineRequest::context |
Definition at line 174 of file enginerequest.h.
Referenced by finalize(), finalizeBody(), finalizeCookies(), finalizeError(), finalizeHeaders(), and Cutelyst::Application::handleRequest().
| QElapsedTimer Cutelyst::EngineRequest::elapsed |
Definition at line 183 of file enginerequest.h.
| Headers Cutelyst::EngineRequest::headers |
Definition at line 160 of file enginerequest.h.
Referenced by finalizeCookies(), finalizeHeaders(), and writeHeaders().
| bool Cutelyst::EngineRequest::isSecure |
Definition at line 180 of file enginerequest.h.
| QString Cutelyst::EngineRequest::method |
Definition at line 137 of file enginerequest.h.
| QString Cutelyst::EngineRequest::path |
Definition at line 140 of file enginerequest.h.
Referenced by setPath(), and writeHeaders().
| QString Cutelyst::EngineRequest::protocol |
Definition at line 146 of file enginerequest.h.
Referenced by writeHeaders().
| QByteArray Cutelyst::EngineRequest::query |
Definition at line 143 of file enginerequest.h.
| QHostAddress Cutelyst::EngineRequest::remoteAddress |
Definition at line 154 of file enginerequest.h.
| quint16 Cutelyst::EngineRequest::remotePort |
Definition at line 177 of file enginerequest.h.
| QString Cutelyst::EngineRequest::remoteUser |
Definition at line 157 of file enginerequest.h.
| QString Cutelyst::EngineRequest::serverAddress |
Definition at line 151 of file enginerequest.h.
| quint64 Cutelyst::EngineRequest::startOfRequest |
Definition at line 163 of file enginerequest.h.
| Status Cutelyst::EngineRequest::status |
Definition at line 166 of file enginerequest.h.
Referenced by finalize(), finalizeBody(), finalizeHeaders(), Cutelyst::Application::handleRequest(), write(), and writeHeaders().