TestHttpHandler

Task-based HTTP connection handler supporting only HTTP GET with response_payload as the response payload.

Constructors

this
this(FinalizeDg finalizer)
Undocumented in source.

Members

Functions

handleHttpException
bool handleHttpException(HttpException e)
Undocumented in source. Be warned that the author may not have intended to support it.
handleHttpServerException
bool handleHttpServerException(HttpServerException e)
Undocumented in source. Be warned that the author may not have intended to support it.
handleRequest
HttpResponseCode handleRequest(cstring response_msg_body)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyIOException
void notifyIOException(ErrnoException e, bool is_error)

Print errors to make debugging easier. If the test succeeds then none of the following methods is called.

Static functions

printEx
void printEx(Exception e)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From TaskHttpConnectionHandler

request
HttpRequest request;

HTTP request message parser

response
HttpResponse response;

HTTP response message generator

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.

default_exception_status_code
auto default_exception_status_code;

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

handle
void handle()

Connection handler method.

reset
void reset()

Resettable interface method; resets the request.

handleRequest
HttpResponseCode handleRequest(cstring response_msg_body)

Handles the request. This method is called while a task is running, see ocean.task.Task.

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.

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.

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".

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.

Meta