1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

per vhost options struct explicitly const

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2016-05-02 06:01:59 +08:00
parent 4664f71ed3
commit 952fcdede1
5 changed files with 14 additions and 13 deletions

View file

@ -92,10 +92,10 @@ lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *pr
return vhost->protocol_vh_privs[n];
}
static struct lws_protocol_vhost_options *
static const struct lws_protocol_vhost_options *
lws_vhost_protocol_options(struct lws_vhost *vh, const char *name)
{
struct lws_protocol_vhost_options *pvo = vh->pvo;
const struct lws_protocol_vhost_options *pvo = vh->pvo;
while (pvo) {
// lwsl_notice("%s: '%s' '%s'\n", __func__, pvo->name, name);
@ -111,7 +111,7 @@ int
lws_protocol_init(struct lws_context *context)
{
struct lws_vhost *vh = context->vhost_list;
struct lws_protocol_vhost_options *pvo;
const struct lws_protocol_vhost_options *pvo;
struct lws wsi;
int n;
@ -143,7 +143,8 @@ lws_protocol_init(struct lws_context *context)
* protocol ptrs so lws_get_context(wsi) etc can work
*/
vh->protocols[n].callback(&wsi,
LWS_CALLBACK_PROTOCOL_INIT, NULL, pvo, 0);
LWS_CALLBACK_PROTOCOL_INIT, NULL,
(void *)pvo, 0);
}
vh = vh->vhost_next;

View file

@ -1726,7 +1726,7 @@ lws_create_basic_wsi(struct lws_context *context, int tsi)
LWS_VISIBLE LWS_EXTERN int
lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len,
int timeout_secs, struct lws_protocol_vhost_options *mp_cgienv)
int timeout_secs, const struct lws_protocol_vhost_options *mp_cgienv)
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
char *env_array[30], cgi_path[400], e[1024], *p = e,

View file

@ -1372,8 +1372,8 @@ lws_set_extension_option(struct lws *wsi, const char *ext_name,
const char *opt_name, const char *opt_val);
struct lws_protocol_vhost_options {
struct lws_protocol_vhost_options *next;
struct lws_protocol_vhost_options *options;
const struct lws_protocol_vhost_options *next;
const struct lws_protocol_vhost_options *options;
const char *name;
const char *value;
};
@ -1384,7 +1384,7 @@ struct lws_http_mount {
const char *origin; /* path to be mounted, eg, "/var/www/warmcat.com" */
const char *def; /* default target, eg, "index.html" */
struct lws_protocol_vhost_options *cgienv;
const struct lws_protocol_vhost_options *cgienv;
int cgi_timeout;
int cache_max_age;
@ -1526,7 +1526,7 @@ struct lws_context_creation_info {
const char *ecdh_curve; /* VH */
const char *vhost_name; /* VH */
const char *plugins_dir; /* context */
struct lws_protocol_vhost_options *pvo; /* VH */
const struct lws_protocol_vhost_options *pvo; /* VH */
int keepalive_timeout; /* VH */
const char *log_filepath; /* VH */
const struct lws_http_mount *mounts; /* VH */
@ -2091,7 +2091,7 @@ struct lws_cgi_args {
LWS_VISIBLE LWS_EXTERN int
lws_cgi(struct lws *wsi, const char * const *exec_array,
int script_uri_path_len, int timeout_secs,
struct lws_protocol_vhost_options *mp_cgienv);
const struct lws_protocol_vhost_options *mp_cgienv);
LWS_VISIBLE LWS_EXTERN int
lws_cgi_write_split_stdout_headers(struct lws *wsi);

View file

@ -649,7 +649,7 @@ struct lws_vhost {
const char *iface;
const struct lws_protocols *protocols;
void **protocol_vh_privs;
struct lws_protocol_vhost_options *pvo;
const struct lws_protocol_vhost_options *pvo;
struct lws **same_vh_protocol_list;
#ifdef LWS_OPENSSL_SUPPORT
SSL_CTX *ssl_ctx;

View file

@ -62,8 +62,8 @@ static int
callback_lws_server_status(struct lws *wsi, enum lws_callback_reasons reason,
void *user, void *in, size_t len)
{
struct lws_protocol_vhost_options *pvo =
(struct lws_protocol_vhost_options *)in;
const struct lws_protocol_vhost_options *pvo =
(const struct lws_protocol_vhost_options *)in;
int m, period = 1000;
switch (reason) {