From 0c8dbadc1f35ddc320d978f1739ca19f5c9d5ace Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 2 Nov 2021 07:10:51 +0000 Subject: [PATCH] examples-lowlevel: ws-server: pvo for WITH_PLUGINS --- .../ws-server/minimal-ws-server/minimal-ws-server.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/minimal-examples/ws-server/minimal-ws-server/minimal-ws-server.c b/minimal-examples/ws-server/minimal-ws-server/minimal-ws-server.c index 921bcffaf..6cfce7f93 100644 --- a/minimal-examples/ws-server/minimal-ws-server/minimal-ws-server.c +++ b/minimal-examples/ws-server/minimal-ws-server/minimal-ws-server.c @@ -54,6 +54,11 @@ static const struct lws_http_mount mount = { /* .basic_auth_login_file */ NULL, }; +#if defined(LWS_WITH_PLUGINS) +/* if plugins enabled, only protocols explicitly named in pvo bind to vhost */ +static struct lws_protocol_vhost_options pvo = { NULL, NULL, "lws-minimal", "" }; +#endif + void sigint_handler(int sig) { interrupted = 1; @@ -85,6 +90,9 @@ int main(int argc, const char **argv) info.mounts = &mount; info.protocols = protocols; info.vhost_name = "localhost"; +#if defined(LWS_WITH_PLUGINS) + info.pvo = &pvo; +#endif info.options = LWS_SERVER_OPTION_HTTP_HEADERS_SECURITY_BEST_PRACTICES_ENFORCE;