libwebsockets
Lightweight C library for HTML5 websockets
Vhost mounts and options
+ Collaboration diagram for Vhost mounts and options:

Data Structures

struct  lws_protocol_vhost_options
 
struct  lws_http_mount
 

Macros

#define AUTH_MODE_MASK   0xF0000000
 

Enumerations

enum  lws_mount_protocols {
  LWSMPRO_HTTP = 0 , LWSMPRO_HTTPS = 1 , LWSMPRO_FILE = 2 , LWSMPRO_CGI = 3 ,
  LWSMPRO_REDIR_HTTP = 4 , LWSMPRO_REDIR_HTTPS = 5 , LWSMPRO_CALLBACK = 6 , LWSMPRO_NO_MOUNT = 7
}
 
enum  lws_authentication_mode { LWSAUTHM_DEFAULT = 0 , LWSAUTHM_BASIC_AUTH_CALLBACK = 1 << 28 }
 

Functions

LWS_VISIBLE LWS_EXTERN void lws_vhost_set_mounts (struct lws_vhost *v, const struct lws_http_mount *mounts)
 

Detailed Description

Vhost mounts and options


Data Structure Documentation

◆ lws_protocol_vhost_options

struct lws_protocol_vhost_options

struct lws_protocol_vhost_options - linked list of per-vhost protocol name=value options

This provides a general way to attach a linked-list of name=value pairs, which can also have an optional child link-list using the options member.

Definition at line 1313 of file lws-context-vhost.h.

+ Collaboration diagram for lws_protocol_vhost_options:
Data Fields
const struct lws_protocol_vhost_options * next

linked list

const struct lws_protocol_vhost_options * options

child linked-list of more options for this node

const char * name

name of name=value pair

const char * value

value of name=value pair

◆ lws_http_mount

struct lws_http_mount

struct lws_http_mount

arguments for mounting something in a vhost's url namespace

Definition at line 1351 of file lws-context-vhost.h.

+ Collaboration diagram for lws_http_mount:
Data Fields
const struct lws_http_mount * mount_next

pointer to next struct lws_http_mount

const char * mountpoint

mountpoint in http pathspace, eg, "/"

const char * origin

path to be mounted, eg, "/var/www/warmcat.com"

const char * def

default target, eg, "index.html"

const char * protocol

"protocol-name" to handle mount

const struct lws_protocol_vhost_options * cgienv

optional linked-list of cgi options. These are created as environment variables for the cgi process

const struct lws_protocol_vhost_options * extra_mimetypes

optional linked-list of mimetype mappings

const struct lws_protocol_vhost_options * interpret

optional linked-list of files to be interpreted

int cgi_timeout

seconds cgi is allowed to live, if cgi://mount type

int cache_max_age

max-age for reuse of client cache of files, seconds

unsigned int auth_mask

bits set here must be set for authorized client session

unsigned int cache_reusable:1

set if client cache may reuse this

unsigned int cache_revalidate:1

set if client cache should revalidate on use

unsigned int cache_intermediaries:1

set if intermediaries are allowed to cache

unsigned int cache_no:1

set if client should check cache always

unsigned char origin_protocol

one of enum lws_mount_protocols

unsigned char mountpoint_len

length of mountpoint string

const char * basic_auth_login_file

NULL, or filepath to use to check basic auth logins against. (requires LWSAUTHM_DEFAULT)

const char * cgi_chroot_path

NULL, or chroot patch for child cgi process

const char * cgi_wd

working directory to cd to after fork of a cgi process, NULL defaults to /tmp

const struct lws_protocol_vhost_options * headers

NULL, or pointer to optional linked list of canned headers that are added to server responses. If given, these override the headers given at the vhost and are used instead of those when the mountpoint matches. This allows to control, eg, CSP on a per-mount basis.

unsigned int keepalive_timeout

0 or seconds http stream should stay alive while idle. 0 means use the vhost value for keepalive_timeout.

Macro Definition Documentation

◆ AUTH_MODE_MASK

#define AUTH_MODE_MASK   0xF0000000

#include <include/libwebsockets/lws-context-vhost.h>

The authentication mode is stored in the top 4 bits of lws_http_mount.auth_mask

Definition at line 1345 of file lws-context-vhost.h.

Enumeration Type Documentation

◆ lws_mount_protocols

#include <include/libwebsockets/lws-context-vhost.h>

enum lws_mount_protocols This specifies the mount protocol for a mountpoint, whether it is to be served from a filesystem, or it is a cgi etc.

Enumerator
LWSMPRO_HTTP 

http reverse proxy

LWSMPRO_HTTPS 

https reverse proxy

LWSMPRO_FILE 

serve from filesystem directory

LWSMPRO_CGI 

pass to CGI to handle

LWSMPRO_REDIR_HTTP 

redirect to http:// url

LWSMPRO_REDIR_HTTPS 

redirect to https:// url

LWSMPRO_CALLBACK 

handle by named protocol's callback

LWSMPRO_NO_MOUNT 

matches fall back to no match processing

Definition at line 1324 of file lws-context-vhost.h.

1324  {
1325  LWSMPRO_HTTP = 0,
1326  LWSMPRO_HTTPS = 1,
1327  LWSMPRO_FILE = 2,
1328  LWSMPRO_CGI = 3,
1329  LWSMPRO_REDIR_HTTP = 4,
1330  LWSMPRO_REDIR_HTTPS = 5,
1331  LWSMPRO_CALLBACK = 6,
1332  LWSMPRO_NO_MOUNT = 7,
1333 };
@ LWSMPRO_NO_MOUNT
@ LWSMPRO_CGI
@ LWSMPRO_HTTP
@ LWSMPRO_FILE
@ LWSMPRO_REDIR_HTTPS
@ LWSMPRO_CALLBACK
@ LWSMPRO_REDIR_HTTP
@ LWSMPRO_HTTPS

◆ lws_authentication_mode

#include <include/libwebsockets/lws-context-vhost.h>

enum lws_authentication_mode This specifies the authentication mode of the mount. The basic_auth_login_file mount parameter is ignored unless LWSAUTHM_DEFAULT is set.

Enumerator
LWSAUTHM_DEFAULT 

default authenticate only if basic_auth_login_file is provided

LWSAUTHM_BASIC_AUTH_CALLBACK 

Basic auth with a custom verifier

Definition at line 1339 of file lws-context-vhost.h.

1339  {
1340  LWSAUTHM_DEFAULT = 0,
1341  LWSAUTHM_BASIC_AUTH_CALLBACK = 1 << 28
1342 };
@ LWSAUTHM_BASIC_AUTH_CALLBACK
@ LWSAUTHM_DEFAULT

Function Documentation

◆ lws_vhost_set_mounts()

LWS_VISIBLE LWS_EXTERN void lws_vhost_set_mounts ( struct lws_vhost *  v,
const struct lws_http_mount mounts 
)