vibe.http.server

A HTTP 1.1/1.0 server implementation.

Public Imports

vibe.core.net
public import vibe.core.net;
Undocumented in source.
vibe.http.common
public import vibe.http.common;
Undocumented in source.
vibe.http.session
public import vibe.http.session;
Undocumented in source.

Members

Aliases

HTTPServerErrorPageHandler
alias HTTPServerErrorPageHandler = void delegate(HTTPServerRequest req, HTTPServerResponse res, HTTPServerErrorInfo error) @(safe)

Delegate type used for user defined error page generator callbacks.

HTTPServerRequestDelegate
alias HTTPServerRequestDelegate = void delegate(HTTPServerRequest req, HTTPServerResponse res) @(safe)

Delegate based request handler

HTTPServerRequestDelegateS
alias HTTPServerRequestDelegateS = void delegate(scope HTTPServerRequest req, scope HTTPServerResponse res) @(safe)

Delegate based request handler with scoped parameters

HTTPServerRequestFunction
alias HTTPServerRequestFunction = void function(HTTPServerRequest req, HTTPServerResponse res) @(safe)

Static function based request handler

HTTPServerRequestFunctionS
alias HTTPServerRequestFunctionS = void function(scope HTTPServerRequest req, scope HTTPServerResponse res) @(safe)

Static function based request handler with scoped parameters

RejectConnectionPredicate
alias RejectConnectionPredicate = bool delegate(in NetworkAddress) @(safe) nothrow

Callback type used to determine whether to reject incoming connections

Classes

HTTPServerContext
class HTTPServerContext

Represents a single HTTP server port.

HTTPServerErrorInfo
class HTTPServerErrorInfo

Aggregates all information about an HTTP error status.

HTTPServerRequest
class HTTPServerRequest

Represents a HTTP request as received by the server side.

HTTPServerResponse
class HTTPServerResponse

Represents a HTTP response as sent from the server side.

HTTPServerSettings
class HTTPServerSettings

Contains all settings for configuring a basic HTTP server.

Enums

HTTPServerOption
enum HTTPServerOption

Specifies optional features of the HTTP server.

SessionOption
enum SessionOption

Options altering how sessions are created.

TestHTTPResponseMode
enum TestHTTPResponseMode
Undocumented in source.

Functions

createTestHTTPServerRequest
HTTPServerRequest createTestHTTPServerRequest(URL url, HTTPMethod method, InputStream data)
HTTPServerRequest createTestHTTPServerRequest(URL url, HTTPMethod method, InetHeaderMap headers, InputStream data)

Creates a HTTPServerRequest suitable for writing unit tests.

createTestHTTPServerResponse
HTTPServerResponse createTestHTTPServerResponse(OutputStream data_sink, SessionStore session_store, TestHTTPResponseMode data_mode)

Creates a HTTPServerResponse suitable for writing unit tests.

handleHTTPConnection
void handleHTTPConnection(TCPConnection connection, HTTPServerContext context)

Treats an existing connection as an HTTP connection and processes incoming requests.

listenHTTP
HTTPListener listenHTTP(Settings _settings, HTTPServerRequestDelegate request_handler)
HTTPListener listenHTTP(Settings settings, HTTPServerRequestFunction request_handler)
HTTPListener listenHTTP(Settings settings, HTTPServerRequestHandler request_handler)
HTTPListener listenHTTP(Settings settings, HTTPServerRequestDelegateS request_handler)
HTTPListener listenHTTP(Settings settings, HTTPServerRequestFunctionS request_handler)
HTTPListener listenHTTP(Settings settings, HTTPServerRequestHandlerS request_handler)

Starts a HTTP server listening on the specified port.

listenHTTP
HTTPListener listenHTTP(Settings settings, void delegate(HTTPServerRequest, HTTPServerResponse) @(system) request_handler)
HTTPListener listenHTTP(Settings settings, void function(HTTPServerRequest, HTTPServerResponse) @(system) request_handler)
HTTPListener listenHTTP(Settings settings, void delegate(scope HTTPServerRequest, scope HTTPServerResponse) @(system) request_handler)
HTTPListener listenHTTP(Settings settings, void function(scope HTTPServerRequest, scope HTTPServerResponse) @(system) request_handler)

Scheduled for deprecation - use a @safe callback instead.

setVibeDistHost
void setVibeDistHost(string host, ushort port)

Sets a VibeDist host to register with.

staticRedirect
HTTPServerRequestDelegate staticRedirect(string url, HTTPStatus status)
HTTPServerRequestDelegate staticRedirect(URL url, HTTPStatus status)

Provides a HTTP request handler that responds with a static redirection to the specified URL.

Interfaces

HTTPServerRequestHandler
interface HTTPServerRequestHandler

Interface for class based request handlers

HTTPServerRequestHandlerS
interface HTTPServerRequestHandlerS

Interface for class based request handlers with scoped parameters

Properties

render
void render [@property getter]

Renders the given Diet template and makes all ALIASES available to the template.

staticTemplate
HTTPServerRequestDelegateS staticTemplate [@property getter]

Provides a HTTP request handler that responds with a static Diet template.

Structs

DefaultDietFilters
struct DefaultDietFilters

Provides the default css, javascript, markdown and htmlescape filters

HTTPListener
struct HTTPListener

Represents the request listener for a specific listenHTTP call.

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.

Authors

Sönke Ludwig, Jan Krüger, Ilya Shipunov