HttpServer

Basic unencrypted HTTP 1.0/1.1 server.

Constructors

this
this(Duration timeout)
Undocumented in source.

Members

Functions

close
void close()

Stop listening, and close idle client connections.

createConnection
IConnection createConnection(TcpConnection tcp)
Undocumented in source. Be warned that the author may not have intended to support it.
listen
ushort listen(ushort port, string addr)

Listen on the given TCP address and port. If port is 0, listen on a random available port. Returns the port that the server is actually listening on.

listen
void listen(AddressInfo[] addresses)

Listen on the given addresses.

onAccept
void onAccept(TcpConnection incoming)
Undocumented in source. Be warned that the author may not have intended to support it.
onClose
void onClose()
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

defaultTimeout
enum defaultTimeout;

The default timeout used for incoming connections.

Properties

localAddresses
Address[] localAddresses [@property getter]

Get listen addresses.

protocol
string protocol [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

banner
string banner;

What to send in the "X-Powered-By" header.

conn
TcpServer conn;
Undocumented in source.
connections
SEDListContainer!HttpServerConnection connections;

Single-ended doubly-linked list of active connections

handleClose
void delegate() handleClose;

Callback for when the socket was closed.

handleRequest
void delegate(HttpRequest request, HttpServerConnection conn) handleRequest;

Callback for an incoming request.

log
Logger log;

Optional HTTP request log.

remoteIPHeader
string remoteIPHeader;

If set, the name of the header which will be used to obtain the actual IP of the connecting peer. Useful when this HttpServer is behind a reverse proxy.

timeout
Duration timeout;
Undocumented in source.

Meta