HttpConnectionHandler

Constructors

this
this(EpollSelectDispatcher dispatcher, FinalizeDg finalizer, size_t stack_size, HttpMethod[] supported_methods)

Constructor

this
this(EpollSelectDispatcher dispatcher, FinalizeDg finalizer, size_t stack_size, HttpRequest request, HttpResponse response, HttpMethod[] supported_methods)

Constructor

Members

Aliases

ErrnoException
alias ErrnoException = .ErrnoException
Undocumented in source.
HttpException
alias HttpException = .HttpException
Undocumented in source.
HttpMethod
alias HttpMethod = .HttpMethod
Undocumented in source.
HttpRequest
alias HttpRequest = .HttpRequest
Undocumented in source.
HttpResponse
alias HttpResponse = .HttpResponse
Undocumented in source.
HttpResponseCode
alias HttpResponseCode = .HttpResponseCode

Type aliases as convenience for a subclass

HttpServerException
alias HttpServerException = .HttpServerException
Undocumented in source.
IOError
alias IOError = .IFiberSelectProtocol.IOError
Undocumented in source.
IOWarning
alias IOWarning = .IFiberSelectProtocol.IOWarning
Undocumented in source.

Functions

handle
void handle()

Connection handler method.

handleHttpException
bool handleHttpException(HttpException e)

Handles HTTP exception e which was thrown while parsing the request message or from handleRequest() or request_msg_body_length(). A subclass may override this method to be notified when an exception is thrown and decide whether the connection may stay persistent or should be closed after the response has been sent. The default behaviour is allowing the connection being persistent unless the status code indicated by the exception is 413: "Request Entity Too Large".

handleHttpServerException
bool handleHttpServerException(HttpServerException e)

Handles HTTP server exception e which was thrown while parsing the request message or from handleRequest() or request_msg_body_length() and is not a HttpException. A subclass may override this method to be notified when an exception is thrown and decide whether the connection may stay persistent or should be closed after the response has been sent. The default behaviour is allowing the connection to stay persistent.

handleRequest
HttpResponseCode handleRequest(cstring response_msg_body)

Handles the request.

notifyIOException
void notifyIOException(ErrnoException e, bool is_error)

Called when an IOWarning or IOError is caught. May be overridden by a subclass to be notified.

onResponseSent
void onResponseSent()

Called after handleRequest() has returned and when the response message buffer is no longer referenced or after handleRequest() has thrown an exception. A subclass may override this method to release resources. This is useful especially when a large number of persistent connections is open where each connection is only used sporadically.

request_msg_body_length
size_t request_msg_body_length()

Tells the request message body length. This method should be overridden when a request message body is expected. It is invoked when the message header is completely parsed. The default behaviour is expecting no request message body.

reset
void reset()

Resettable interface method; resets the request.

Variables

default_exception_status_code
auto default_exception_status_code;

Status code for the case when a required message header parameters are missing.

http_exception
HttpException http_exception;

Reused exception instance; may be thrown by a subclass as well.

keep_alive_maxnum
uint keep_alive_maxnum;

Maximum number of requests through the same connection when using persistent connections; 0 disables using persistent connections.

request
HttpRequest request;

HTTP request message parser and response message generator

response
HttpResponse response;
Undocumented in source.

Inherited Members

From IFiberConnectionHandler

use_buffered_writer_by_default
bool use_buffered_writer_by_default;

If true, a buffered writer is used by default.

SelectReader
alias SelectReader = .FiberSelectReader

Local aliases for SelectReader and SelectWriter.

SelectWriter
alias SelectWriter = .FiberSelectWriter
Undocumented in source.
reader
SelectReader reader;

SelectReader and SelectWriter used for asynchronous protocol i/o.

writer
SelectWriter writer;
Undocumented in source.
io_warning
IOWarning io_warning;

IOWarning exception instance used by the reader and writer.

io_error
bool io_error()

Called by IConnectionHandler.finalize(), in order to determine if an I/O error was reported for the connection conduit which made the connection automatically being closed. (See comment for IConnectionHandler.finalize() method.)

reset
void reset()

Resettable interface method, resets the reader.

Meta