-
public void add_auth_domain (AuthDomain auth_domain)
Adds an authentication domain to server. Each auth domain will have the chance to require
authentication for each request that comes in; normally auth domains will require authentication for requests on certain paths that
they have been set up to watch, or that meet other criteria set by the caller. If an auth domain determines that a request requires
authentication (and the request doesn't contain authentication), server will automatically reject the request with an
appropriate status (401 Unauthorized or 407 Proxy Authentication Required). If the request used the "100-continue" Expectation,
server will reject it before the request body is sent.
-
public void add_handler (string? path, owned ServerCallback callback)
Adds a handler to server for requests under path. See the documentation for
ServerCallback for information about how callbacks should behave.
-
public weak MainContext get_async_context ()
Gets server's async_context. This does not add a ref to the context, so you will need to
ref it yourself if you want it to outlive its server.
-
public weak Socket get_listener ()
Gets server's listening socket. You should treat this as read-only; writing to it or
modifiying it may cause server to malfunction.
-
public uint get_port ()
Gets the TCP port that server is listening on. This is most useful when you did not request
a specific port (or explicitly requested ADDRESS_ANY_PORT).
-
public bool is_https ()
Checks whether server is running plain http or https.
-
public void pause_message (Message msg)
Pauses I/O on msg. This can be used when you need to return from the server handler without
having the full response ready yet. Use unpause_message to resume I/O.
-
public void quit ()
Stops processing for server. Call this to clean up after
run_async, or to terminate a call to
run.
-
public void remove_auth_domain (AuthDomain auth_domain)
Removes auth_domain from server.
-
public void remove_handler (string path)
Removes the handler registered at path.
-
public void run ()
Starts server, causing it to listen for and process incoming connections. Unlike
run_async, this creates a
MainLoop and runs it, and it will not return until someone calls
quit to stop the server.
-
public void run_async ()
Starts server, causing it to listen for and process incoming connections.
-
public void unpause_message (Message msg)
Resumes I/O on msg. Use this to resume after calling
pause_message, or after adding a new chunk to a chunked response.