NodeC  0.1
HTTP Static Content Server.

Serve static content over HTTP 1.1. More...

Data Structures

struct  http_static_config_t
 HTTP Static server configuration. More...
 

Macros

#define http_static_default_config()
 Return the default static server configuration.
 

Functions

void http_serve_static (const char *root, const http_static_config_t *config)
 Serve static files under a root directory. More...
 

Variables

const char * http_static_implicit_exts []
 Default file extensions for the static content server. More...
 

Detailed Description

Serve static content over HTTP 1.1.


Data Structure Documentation

◆ http_static_config_t

struct http_static_config_t

HTTP Static server configuration.

Data Fields
const char * cache_control If not NULL, specifies the cache control header. By default "public, max-age=604800".
size_t content_max_size Maximum size of content to serve (by default SIZE_MAX).
size_t gzip_min_size Enable gzip compression above this file size (default is 1KB) (if the MIME type is compressible). Set to SIZE_MAX to disable compression.
bool gzip_vary If compression is enabled, add the VARY header. By default true.
const char ** implicit_exts NULL terminated array of implicit extensions, by default {".html",".htm",NULL}.
const char * implicit_index If not NULL, specifies the default index file, by default "index.html".
size_t read_buf_size Read buffer chunk size, by default 64KB.
bool use_etag Generate cluster-safe ETag's for efficient caching, By default true.

However, the server also generates Last-Modified headers and respects both If-Modified-Since and If-None-Match headers with efficient 304 responses.

bool use_last_modified Generate Last-Modified headers for efficient caching, By default true.

The server checks If-Modified-Since headers with efficient 304 responses.

Function Documentation

◆ http_serve_static()

void http_serve_static ( const char *  root,
const http_static_config_t config 
)

Serve static files under a root directory.

Parameters
configThe configuration. Can be NULL for the default configuration. Supports efficient 304 Not-Modified responses with Last-Modified and and ETag headers, and can do dynamic gzip compression (if enabled).

Variable Documentation

◆ http_static_implicit_exts

const char* http_static_implicit_exts[]

Default file extensions for the static content server.

Initialized to {".html",".htm",NULL}.