diff --git a/README.lwsws.md b/README.lwsws.md index 165ed607..aeb8bc8c 100644 --- a/README.lwsws.md +++ b/README.lwsws.md @@ -90,6 +90,9 @@ if a keyword is found in the user agent }] ``` + - `timeout-secs` lets you set the global timeout for various network-related + operations in lws, in seconds. It defaults to 5. + @section lwswsv Lwsws Vhosts One server can run many vhosts, where SSL is in use SNI is used to match diff --git a/doc/html/md_README_8lwsws.html b/doc/html/md_README_8lwsws.html index 8fe3dcee..0cfb403b 100644 --- a/doc/html/md_README_8lwsws.html +++ b/doc/html/md_README_8lwsws.html @@ -88,7 +88,10 @@ Other Global Options -
"reject-service-keywords": [{
"scumbot": "404 Not Found"
}]

+
"reject-service-keywords": [{
"scumbot": "404 Not Found"
}]
+

Lwsws Vhosts

One server can run many vhosts, where SSL is in use SNI is used to match the connection to a vhost and its vhost-specific SSL keys during SSL negotiation.

Listing multiple vhosts looks something like this

{
"vhosts": [ {
"name": "localhost",
"port": "443",
"host-ssl-key": "/etc/pki/tls/private/libwebsockets.org.key",
"host-ssl-cert": "/etc/pki/tls/certs/libwebsockets.org.crt",
"host-ssl-ca": "/etc/pki/tls/certs/libwebsockets.org.cer",
"mounts": [{
"mountpoint": "/",
"origin": "file:///var/www/libwebsockets.org",
"default": "index.html"
}, {
"mountpoint": "/testserver",
"origin": "file:///usr/local/share/libwebsockets-test-server",
"default": "test.html"
}],
# which protocols are enabled for this vhost, and optional
# vhost-specific config options for the protocol
#
"ws-protocols": [{
"warmcat,timezoom": {
"status": "ok"
}
}]
},
{
"name": "localhost",
"port": "7681",
"host-ssl-key": "/etc/pki/tls/private/libwebsockets.org.key",
"host-ssl-cert": "/etc/pki/tls/certs/libwebsockets.org.crt",
"host-ssl-ca": "/etc/pki/tls/certs/libwebsockets.org.cer",
"mounts": [{
"mountpoint": "/",
"origin": ">https://localhost"
}]
},
{
"name": "localhost",
"port": "80",
"mounts": [{
"mountpoint": "/",
"origin": ">https://localhost"
}]
}
]
}

That sets up three vhosts all called "localhost" on ports 443 and 7681 with SSL, and port 80 without SSL but with a forced redirect to https://localhost

diff --git a/lib/lejp-conf.c b/lib/lejp-conf.c index 39f6ca46..b35b0290 100644 --- a/lib/lejp-conf.c +++ b/lib/lejp-conf.c @@ -37,6 +37,7 @@ static const char * const paths_global[] = { "global.server-string", "global.plugin-dir", "global.ws-pingpong-secs", + "global.timeout-secs", "global.reject-service-keywords[].*", "global.reject-service-keywords[]", }; @@ -49,6 +50,7 @@ enum lejp_global_paths { LEJPGP_SERVER_STRING, LEJPGP_PLUGIN_DIR, LWJPGP_PINGPONG_SECS, + LWJPGP_TIMEOUT_SECS, LWJPGP_REJECT_SERVICE_KEYWORDS_NAME, LWJPGP_REJECT_SERVICE_KEYWORDS }; @@ -269,6 +271,10 @@ lejp_globals_cb(struct lejp_ctx *ctx, char reason) a->info->ws_ping_pong_interval = atoi(ctx->buf); return 0; + case LWJPGP_TIMEOUT_SECS: + a->info->timeout_secs = atoi(ctx->buf); + return 0; + default: return 0; }