diff --git a/CMakeLists-implied-options.txt b/CMakeLists-implied-options.txt index e3e800419..f9381454a 100644 --- a/CMakeLists-implied-options.txt +++ b/CMakeLists-implied-options.txt @@ -379,6 +379,12 @@ if (LWS_WITHOUT_SERVER) set(LWS_WITH_SERVER) endif() +if (LWS_WITH_SERVER) +else() + set(LWS_WITH_CGI 0) + set(LWS_ROLE_CGI 0) +endif() + if (LWS_WITH_UPNG) set(LWS_WITH_GZINFLATE 1) endif() diff --git a/lib/event-libs/libev/libev.c b/lib/event-libs/libev/libev.c index 3f3f2a7f0..6b460d6c4 100644 --- a/lib/event-libs/libev/libev.c +++ b/lib/event-libs/libev/libev.c @@ -139,6 +139,7 @@ lws_ev_sigint_cb(struct ev_loop *loop, struct ev_signal *watcher, int revents) static int elops_listen_init_ev(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); struct lws_context *context = (struct lws_context *)user; struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi]; @@ -153,6 +154,7 @@ elops_listen_init_ev(struct lws_dll2 *d, void *user) ev_io_init(&vh_to_priv_ev(vh)->w_accept.watcher, lws_accept_cb, wsi->desc.sockfd, EV_READ); ev_io_start(ptpr->io_loop, &vh_to_priv_ev(vh)->w_accept.watcher); +#endif return 0; } @@ -243,6 +245,7 @@ elops_init_pt_ev(struct lws_context *context, void *_loop, int tsi) static int elops_listen_destroy_ev(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); struct lws_context *context = (struct lws_context *)user; struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi]; @@ -250,7 +253,7 @@ elops_listen_destroy_ev(struct lws_dll2 *d, void *user) struct lws_vhost *vh = wsi->a.vhost; ev_io_stop(ptpr->io_loop, &vh_to_priv_ev(vh)->w_accept.watcher); - +#endif return 0; } diff --git a/lib/event-libs/libevent/libevent.c b/lib/event-libs/libevent/libevent.c index b7b310ca7..aaee58809 100644 --- a/lib/event-libs/libevent/libevent.c +++ b/lib/event-libs/libevent/libevent.c @@ -176,6 +176,7 @@ lws_event_sigint_cb(evutil_socket_t sock_fd, short revents, void *ctx) static int elops_listen_init_event(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); struct lws_context *context = (struct lws_context *)user; struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi]; @@ -188,6 +189,7 @@ elops_listen_init_event(struct lws_dll2 *d, void *user) (EV_READ | EV_PERSIST), lws_event_cb, w_read); event_add(w_read->watcher, NULL); w_read->set = 1; +#endif return 0; } @@ -334,6 +336,7 @@ elops_run_pt_event(struct lws_context *context, int tsi) static int elops_listen_destroy_event(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); struct lws_wsi_eventlibs_libevent *w = wsi_to_priv_event(wsi); @@ -341,6 +344,7 @@ elops_listen_destroy_event(struct lws_dll2 *d, void *user) w->w_read.watcher = NULL; event_free(w->w_write.watcher); w->w_write.watcher = NULL; +#endif return 0; } diff --git a/lib/event-libs/libuv/libuv.c b/lib/event-libs/libuv/libuv.c index e213b8dd9..699aaf386 100644 --- a/lib/event-libs/libuv/libuv.c +++ b/lib/event-libs/libuv/libuv.c @@ -698,10 +698,12 @@ elops_destroy_pt_uv(struct lws_context *context, int tsi) static int elops_listen_init_uv(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); if (elops_init_vhost_listen_wsi_uv(wsi) == -1) return -1; +#endif return 0; } diff --git a/lib/event-libs/sdevent/sdevent.c b/lib/event-libs/sdevent/sdevent.c index 0c7ddaec8..9779d3bab 100644 --- a/lib/event-libs/sdevent/sdevent.c +++ b/lib/event-libs/sdevent/sdevent.c @@ -234,10 +234,12 @@ init_vhost_listen_wsi_sd(struct lws *wsi) static int elops_listen_init_sdevent(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); if (init_vhost_listen_wsi_sd(wsi) == -1) return -1; +#endif return 0; } @@ -368,9 +370,11 @@ run_pt_sd(struct lws_context *context, int tsi) static int elops_listen_destroy_sdevent(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); wsi_logical_close_sd(wsi); +#endif return 0; } diff --git a/lib/event-libs/uloop/uloop.c b/lib/event-libs/uloop/uloop.c index be9046c75..a6a14bb9e 100644 --- a/lib/event-libs/uloop/uloop.c +++ b/lib/event-libs/uloop/uloop.c @@ -135,6 +135,7 @@ lws_uloop_cb(struct uloop_fd *ufd, unsigned int revents) static int elops_listen_init_uloop(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); struct lws_wsi_eventlibs_uloop *wu = wsi_to_priv_uloop(wsi); @@ -143,6 +144,7 @@ elops_listen_init_uloop(struct lws_dll2 *d, void *user) wu->fd.cb = lws_uloop_cb; uloop_fd_add(&wu->fd, ULOOP_READ); wu->actual_events = ULOOP_READ; +#endif return 0; } @@ -217,10 +219,12 @@ elops_run_pt_uloop(struct lws_context *context, int tsi) static int elops_listen_destroy_uloop(struct lws_dll2 *d, void *user) { +#if defined(LWS_WITH_SERVER) struct lws *wsi = lws_container_of(d, struct lws, listen_list); struct lws_wsi_eventlibs_uloop *wu = wsi_to_priv_uloop(wsi); uloop_fd_delete(&wu->fd); +#endif return 0; }