|config name args|
|log request response|
|route method pattern host args|
|error e sock|
|respond event sock|
|accept sock addr port|
Create a new server, with optional
$newOpts list of pairs indicating configuration. Accepted values are:
The protocol to accept connections for. Defaults to
http, but can be
Defaults to 4096. The size of buffer used to read from remote sockets and local files.
Defaults to the simple standard output logger provided in ::tanzer::logger::default. Any command or object that provides
err subcommands is suitable; a no-op proc is also useful for suppressing logging altogether.
|tanzer::server::accept||sock addr port|
Accepts an inbound connection as a callback to
[socket -server]. Creates a new tanzer::session object associated with
$sock, and installs the server's default event handler for
$sock for only
read events, initially.
Use this method directly if you intend to listen on multiple sockets, a different host address, or if you wish to use ::tls::socket to create a listener instead.
$sock, destroy the associated session handler, and forget about the socket and session handler.
Query configuration value
$name from server, or set configuration for
$name with a second argument provided as value.
Serve the error message
$e for the session associated with
$sock, and immediately end the session and close the socket.
Make the server completely forget about
$sock. The server will forget about the session handler associated with the socket.
Listen for inbound connections on
$port, and enter the socket handling event loop. This simply creates a new listener with
[socket -server] and dispatches all inbound connections to tanzer::server::accept.
Do not use this if you intend to listen to listen on multiple sockets, or if you wish to use TLS.
The default I/O event handler associated with new connection sockets opened by the server.
$event is one of
write. Not meant to be called directly.
|tanzer::server::route||method pattern host args|
Route a request handler to the server. Arguments are as follows:
A non-anchored regular expression performing a case insensitive match on the incoming HTTP request method. Anchoring is performed by the request route matching engine.
A URI path, containing any number of path components describing named parameters in the
:param style. Paths ending with
* will match any incoming URI path parts before the glob.
A non-anchored regular expression performing a case insensitive match on the incoming HTTP Host: request header. Anchoring is performed by the request route matching engine.
Any number of arguments desribing the request handler to be dispatched for requests that match the route described by an invocation to this method.
The following arguments will be appended to the script specified in
write, indicating the session socket is ready to be read from or written to
readevent, a chunk of data read from the request body
Return the routing table object the server is currently using.