2 Struct N_HTTP_SERVER_CONFIG
gullradriel edited this page 2026-11-01 16:37:14 +01:00

N_HTTP_SERVER_CONFIG

Module: HTTP SERVER: TLS or plain HTTP/1.1, deadlines, limits, keep-alive

server settings; start from n_http_server_config_defaults()

#include "n_http_server.h"

Public Attributes

Name
int write_timeout_ms
deadline to write one response, ms (default 60000); for a streamed body, to write each piece of it (a long stream is not cut)
size_t workers
worker threads = most concurrent connections (default 32)
void * user
passed to the handler
const char * tls_key_file
PEM private key, NULL for plain HTTP.
const char * tls_cert_file
PEM certificate chain, NULL for plain HTTP.
int require_host
refuse HTTP/1.1 requests without exactly one Host (default 1)
const char * port
port to bind ("7430")
size_t max_requests_per_conn
requests served on one connection before it is closed (default 1000)
size_t max_per_ip
most connections from one peer address, 0 for no limit (default 0: behind a reverse proxy every connection has the proxy's address)
long long max_body
largest Content-Length accepted at all (default 32 MiB); handlers pass their own, lower cap to the body readers
int idle_timeout_ms
wait for the next request on a kept-alive connection, ms (default 15000)
int header_timeout_ms
request head deadline from its first byte, ms (default 10000)
int handshake_timeout_ms
TLS handshake deadline, ms (default 10000).
n_http_server_handler handler
the application
int body_timeout_ms
body deadline, ms (default 60000)
const char * addr
address to bind ("127.0.0.1")

Public Attributes Documentation

variable write_timeout_ms

int write_timeout_ms;

deadline to write one response, ms (default 60000); for a streamed body, to write each piece of it (a long stream is not cut)

variable workers

size_t workers;

worker threads = most concurrent connections (default 32)

variable user

void * user;

passed to the handler

variable tls_key_file

const char * tls_key_file;

PEM private key, NULL for plain HTTP.

variable tls_cert_file

const char * tls_cert_file;

PEM certificate chain, NULL for plain HTTP.

variable require_host

int require_host;

refuse HTTP/1.1 requests without exactly one Host (default 1)

variable port

const char * port;

port to bind ("7430")

variable max_requests_per_conn

size_t max_requests_per_conn;

requests served on one connection before it is closed (default 1000)

variable max_per_ip

size_t max_per_ip;

most connections from one peer address, 0 for no limit (default 0: behind a reverse proxy every connection has the proxy's address)

variable max_body

long long max_body;

largest Content-Length accepted at all (default 32 MiB); handlers pass their own, lower cap to the body readers

variable idle_timeout_ms

int idle_timeout_ms;

wait for the next request on a kept-alive connection, ms (default 15000)

variable header_timeout_ms

int header_timeout_ms;

request head deadline from its first byte, ms (default 10000)

variable handshake_timeout_ms

int handshake_timeout_ms;

TLS handshake deadline, ms (default 10000).

variable handler

n_http_server_handler handler;

the application

variable body_timeout_ms

int body_timeout_ms;

body deadline, ms (default 60000)

variable addr

const char * addr;

address to bind ("127.0.0.1")