vibe.http.fileserver

A static HTTP file server.

Members

Classes

HTTPFileServerSettings
class HTTPFileServerSettings

Configuration options for the static file server.

Enums

HTTPFileServerOption
enum HTTPFileServerOption

Additional options for the static file server.

Functions

cacheMatch
bool cacheMatch(string match, ETag etag, Flag!"allowWeak" allow_weak)

Matches a given match expression with a specific ETag. Can allow or disallow weak ETags and supports multiple tags.

handleCache
bool handleCache(HTTPServerRequest req, HTTPServerResponse res, ETag etag, SysTime last_modified, string cache_control, Duration max_age)

Processes header tags in a request and writes responses given on requested cache status.

handleCacheFile
bool handleCacheFile(HTTPServerRequest req, HTTPServerResponse res, string file, string cache_control, Duration max_age)
bool handleCacheFile(HTTPServerRequest req, HTTPServerResponse res, NativePath file, string cache_control, Duration max_age)
bool handleCacheFile(HTTPServerRequest req, HTTPServerResponse res, FileInfo dirent, string cache_control, Duration max_age)

Calls handleCache with prefilled etag and lastModified value based on a file.

sendFile
void sendFile(HTTPServerRequest req, HTTPServerResponse res, NativePath path, HTTPFileServerSettings settings)

Sends a file to the given HTTP server response object.

serveStaticFile
HTTPServerRequestDelegateS serveStaticFile(NativePath local_path, HTTPFileServerSettings settings)
HTTPServerRequestDelegateS serveStaticFile(string local_path, HTTPFileServerSettings settings)

Returns a request handler that serves a specific file on disk.

serveStaticFiles
HTTPServerRequestDelegateS serveStaticFiles(NativePath local_path, HTTPFileServerSettings settings)
HTTPServerRequestDelegateS serveStaticFiles(string local_path, HTTPFileServerSettings settings)

Returns a request handler that serves files from the specified directory.

Structs

ETag
struct ETag

Represents an Entity-Tag value for use inside HTTP Cache headers.

Meta

License

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

Authors

Sönke Ludwig