diff --git a/lib/context.c b/lib/context.c index 41b2fba6..ae84c1f7 100644 --- a/lib/context.c +++ b/lib/context.c @@ -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; diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 6f86d1c6..b34430bf 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -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, diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index 41c4c906..1f693461 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -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); diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index 16f435da..91f4d757 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -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; diff --git a/plugins/protocol_lws_server_status.c b/plugins/protocol_lws_server_status.c index b9301745..b41a719a 100644 --- a/plugins/protocol_lws_server_status.c +++ b/plugins/protocol_lws_server_status.c @@ -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) {