lwsws conf unix sockets support vhost conf option
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
144594dd43
commit
a1ab201436
2 changed files with 16 additions and 3 deletions
|
@ -155,14 +155,17 @@ Vhosts can select which plugins they want to offer and give them per-vhost setti
|
|||
Other vhost options
|
||||
-------------------
|
||||
|
||||
- If the three options "host-ssl-cert", "host-ssl-ca" and "host-ssl-key" are given, then the vhost supports SSL.
|
||||
- If the three options `host-ssl-cert`, `host-ssl-ca` and `host-ssl-key` are given, then the vhost supports SSL.
|
||||
|
||||
Each vhost may have its own certs, SNI is used during the initial connection negotiation to figure out which certs to use by the server name it's asking for from the request DNS name.
|
||||
|
||||
- keeplive-timeout (in secs) defaults to 60 for lwsws, it may be set as a vhost option
|
||||
- `keeplive-timeout` (in secs) defaults to 60 for lwsws, it may be set as a vhost option
|
||||
|
||||
- `interface` lets you specify which network interface to listen on, if not given listens on all
|
||||
|
||||
- "`unix-socket`": "1" causes the unix socket specified in the interface option to be used instead of an INET socket
|
||||
|
||||
|
||||
Mounts
|
||||
------
|
||||
|
||||
|
|
12
lwsws/conf.c
12
lwsws/conf.c
|
@ -41,6 +41,7 @@ static const char * const paths_vhosts[] = {
|
|||
"vhosts[].name",
|
||||
"vhosts[].port",
|
||||
"vhosts[].interface",
|
||||
"vhosts[].unix-socket",
|
||||
"vhosts[].host-ssl-key",
|
||||
"vhosts[].host-ssl-cert",
|
||||
"vhosts[].host-ssl-ca",
|
||||
|
@ -61,6 +62,7 @@ enum lejp_vhost_paths {
|
|||
LEJPVP_NAME,
|
||||
LEJPVP_PORT,
|
||||
LEJPVP_INTERFACE,
|
||||
LEJPVP_UNIXSKT,
|
||||
LEJPVP_HOST_SSL_KEY,
|
||||
LEJPVP_HOST_SSL_CERT,
|
||||
LEJPVP_HOST_SSL_CA,
|
||||
|
@ -97,7 +99,8 @@ lwsws_align(struct jpargs *a)
|
|||
return a->p;
|
||||
}
|
||||
|
||||
static int arg_to_bool(const char *s)
|
||||
static int
|
||||
arg_to_bool(const char *s)
|
||||
{
|
||||
static const char * const on[] = { "on", "yes", "true" };
|
||||
int n = atoi(s);
|
||||
|
@ -187,6 +190,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
|
|||
"!AES256-SHA256";
|
||||
a->info->pvo = NULL;
|
||||
a->info->keepalive_timeout = 60;
|
||||
a->info->options &= ~(LWS_SERVER_OPTION_UNIX_SOCK);
|
||||
}
|
||||
|
||||
if (reason == LEJPCB_OBJECT_START &&
|
||||
|
@ -270,6 +274,12 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
|
|||
case LEJPVP_INTERFACE:
|
||||
a->info->iface = a->p;
|
||||
break;
|
||||
case LEJPVP_UNIXSKT:
|
||||
if (arg_to_bool(ctx->buf))
|
||||
a->info->options |= LWS_SERVER_OPTION_UNIX_SOCK;
|
||||
else
|
||||
a->info->options &= ~(LWS_SERVER_OPTION_UNIX_SOCK);
|
||||
return 0;
|
||||
case LEJPVP_HOST_SSL_KEY:
|
||||
a->info->ssl_private_key_filepath = a->p;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue