HTTPServerOption

Specifies optional features of the HTTP server.

Disabling unneeded features can speed up the server or reduce its memory usage.

Note that the options parseFormBody, parseJsonBody and parseMultiPartBody will also drain the HTTPServerRequest.bodyReader stream whenever a request body with form or JSON data is encountered.

Values

ValueMeaning
none0
parseURL1 << 0

Fills the .path and .queryString fields in the request

parseQueryString1 << 1 | parseURL

Deprecated: Fills the .query field in the request

parseFormBody1 << 2

Deprecated: Fills the .form field in the request

parseJsonBody1 << 3

Deprecated: Fills the .json field in the request

parseMultiPartBody1 << 4

Deprecated: Fills the .files field of the request for "multipart/mixed" requests

parseCookies1 << 5

Deprecated: Fills the .cookies field in the request

distribute1 << 6

Deprecated: Distributes request processing among worker threads

Note that this functionality assumes that the request handler is implemented in a thread-safe way. However, the D type system is bypassed, so that no static verification takes place.

For this reason, it is recommended to instead use vibe.core.core.runWorkerTaskDist and call listenHTTP from each task/thread individually. If the reusePort option is set, then all threads will be able to listen on the same port, with the operating system distributing the incoming connections.

If possible, instead of threads, the use of separate processes is more robust and often faster. The reusePort option works the same way in this scenario.

errorStackTraces1 << 7

Enables stack traces (HTTPServerErrorInfo.debugMessage).

Note that generating the stack traces are generally a costly operation that should usually be avoided in production environments. It can also reveal internal information about the application, such as function addresses, which can help an attacker to abuse possible security holes.

reusePort1 << 8

Enable port reuse in listenTCP()

defaultsparseURL | parseQueryString | parseFormBody | parseJsonBody | parseMultiPartBody | parseCookies | ()()

The default set of options.

Includes all parsing options, as well as the errorStackTraces option if the code is compiled in debug mode.

Nonenone

deprecated

ParseURLparseURL

deprecated

ParseQueryStringparseQueryString

deprecated

ParseFormBodyparseFormBody

deprecated

ParseJsonBodyparseJsonBody

deprecated

ParseMultiPartBodyparseMultiPartBody

deprecated

ParseCookiesparseCookies

deprecated

Meta