diff --git a/CMakeLists.txt b/CMakeLists.txt index db2ea7809..f58595db6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -449,10 +449,6 @@ else() set(LWS_OPENSSL_CLIENT_CERTS /etc/pki/tls/certs/ CACHE PATH "Client SSL certificate directory") endif() -if (LWS_WITHOUT_EXTENSIONS) - set(LWS_NO_EXTENSIONS 1) -endif() - if (LWS_WITH_SSL) set(LWS_OPENSSL_SUPPORT 1) endif() diff --git a/cmake/lws_config.h.in b/cmake/lws_config.h.in index 64904e8e6..1d935c8d4 100644 --- a/cmake/lws_config.h.in +++ b/cmake/lws_config.h.in @@ -46,7 +46,6 @@ #cmakedefine LWS_OPENSSL_CLIENT_CERTS "${LWS_OPENSSL_CLIENT_CERTS}" /* Turn off websocket extensions */ -#cmakedefine LWS_NO_EXTENSIONS #cmakedefine LWS_WITHOUT_EXTENSIONS /* notice if client or server gone */ diff --git a/lib/client/client-parser.c b/lib/client/client-parser.c index bd5503771..485b31b51 100644 --- a/lib/client/client-parser.c +++ b/lib/client/client-parser.c @@ -100,7 +100,7 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c) wsi->ws->rsv = (c & 0x70); /* revisit if an extension wants them... */ if ( -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) !wsi->count_act_ext && #endif wsi->ws->rsv) { @@ -557,7 +557,7 @@ utf8_fail: if ( /* coverity says dead code otherwise */ -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) n && #endif eff_buf.token_len) diff --git a/lib/client/client.c b/lib/client/client.c index 25e345c21..4a0230430 100644 --- a/lib/client/client.c +++ b/lib/client/client.c @@ -545,7 +545,7 @@ lws_client_interpret_server_handshake(struct lws *wsi) struct allocated_headers *ah = NULL; char *p, *q; char new_path[300]; -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi]; char *sb = (char *)&pt->serv_buf[0]; const struct lws_ext_options *opts; @@ -921,7 +921,7 @@ check_extensions: lws_vhost_unlock(wsi->vhost); -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) /* instantiate the accepted extensions */ if (!lws_hdr_total_length(wsi, WSI_TOKEN_EXTENSIONS)) { @@ -1146,7 +1146,7 @@ check_accept: cce = "HS: Rejected at CLIENT_ESTABLISHED"; goto bail3; } -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) /* * inform all extensions, not just active ones since they * already know @@ -1198,7 +1198,7 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt) struct lws_context *context = wsi->context; const char *meth; int n; -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) const struct lws_extension *ext; int ext_count = 0; #endif @@ -1305,7 +1305,7 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt) /* tell the server what extensions we could support */ -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) ext = wsi->vhost->extensions; while (ext && ext->callback) { n = lws_ext_cb_all_exts(context, wsi, diff --git a/lib/context.c b/lib/context.c index fae8f900a..e0ecf4440 100644 --- a/lib/context.c +++ b/lib/context.c @@ -748,7 +748,7 @@ lws_create_vhost(struct lws_context *context, mounts = mounts->mount_next; } -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) #ifdef LWS_WITH_PLUGINS if (context->plugin_extension_count) { @@ -1593,7 +1593,7 @@ lws_vhost_destroy2(struct lws_vhost *vh) } #ifdef LWS_WITH_PLUGINS -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) if (context->plugin_extension_count) lws_free((void *)vh->extensions); #endif diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 1c3fac8a1..997c103bd 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -2322,7 +2322,7 @@ lws_parse_uri(char *p, const char **prot, const char **ads, int *port, return 0; } -#ifdef LWS_NO_EXTENSIONS +#if defined(LWS_WITHOUT_EXTENSIONS) /* we need to provide dummy callbacks for internal exts * so user code runs when faced with a lib compiled with @@ -2767,7 +2767,7 @@ lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name) return pvo; } -#ifdef LWS_NO_EXTENSIONS +#if defined(LWS_WITHOUT_EXTENSIONS) LWS_EXTERN int lws_set_extension_option(struct lws *wsi, const char *ext_name, const char *opt_name, const char *opt_val) diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index 5d5182362..5035cfad8 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -2157,7 +2157,7 @@ LWS_VISIBLE LWS_EXTERN int lws_set_extension_option(struct lws *wsi, const char *ext_name, const char *opt_name, const char *opt_val); -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) /* lws_get_internal_extensions() - DEPRECATED * * \Deprecated There is no longer a set internal extensions table. The table is provided diff --git a/lib/output.c b/lib/output.c index 1da9af890..31ccb3786 100644 --- a/lib/output.c +++ b/lib/output.c @@ -49,7 +49,7 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len) struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi]; size_t real_len = len; unsigned int n; -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) int m; #endif @@ -91,7 +91,7 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len) return -1; } -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) m = lws_ext_cb_active(wsi, LWS_EXT_CB_PACKET_TX_DO_SEND, &buf, (int)len); if (m < 0) return -1; @@ -137,7 +137,7 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len) n = 0; break; } -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) handle_truncated_send: #endif /* @@ -320,7 +320,7 @@ LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len, case LWS_WRITE_CLOSE: break; default: -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) lwsl_debug("LWS_EXT_CB_PAYLOAD_TX\n"); n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_TX, &eff_buf, wp); if (n < 0) diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index e3636fc13..994d1054c 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -977,7 +977,7 @@ struct lws_vhost { #if defined(LWS_WITH_MBEDTLS) lws_tls_x509 *x509_client_CA; #endif -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) const struct lws_extension *extensions; #endif struct lws_timed_vh_protocol *timed_vh_protocol_list; @@ -1888,7 +1888,7 @@ struct lws { /* truncated send handling */ unsigned char *trunc_alloc; /* non-NULL means buffering in progress */ -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) const struct lws_extension *active_extensions[LWS_MAX_EXTENSIONS_ACTIVE]; void *act_ext_user[LWS_MAX_EXTENSIONS_ACTIVE]; #endif @@ -1973,7 +1973,7 @@ struct lws { #ifdef LWS_WITH_HTTP_PROXY unsigned int perform_rewrite:1; #endif -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) unsigned int extension_data_pending:1; #endif #ifdef LWS_OPENSSL_SUPPORT @@ -1996,7 +1996,7 @@ struct lws { uint8_t mode; /* enum connection_mode */ /* chars */ -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) uint8_t count_act_ext; #endif uint8_t state_pre_close; @@ -2149,7 +2149,7 @@ lws_client_stash_destroy(struct lws *wsi); * EXTENSIONS */ -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) LWS_VISIBLE void lws_context_init_extensions(struct lws_context_creation_info *info, struct lws_context *context); diff --git a/lib/server/parsers.c b/lib/server/parsers.c index 9af538eb5..dffd75ea8 100644 --- a/lib/server/parsers.c +++ b/lib/server/parsers.c @@ -1252,7 +1252,7 @@ lws_rx_sm(struct lws *wsi, unsigned char c) int callback_action = LWS_CALLBACK_RECEIVE; int ret = 0, rx_draining_ext = 0; struct lws_tokens eff_buf; -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) int n; #endif @@ -1703,7 +1703,7 @@ drain_extension: if (wsi->state == LWSS_RETURNED_CLOSE_ALREADY || wsi->state == LWSS_AWAITING_CLOSE_ACK) goto already_done; -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_RX, &eff_buf, 0); #endif /* @@ -1711,7 +1711,7 @@ drain_extension: * it's the output */ wsi->ws->first_fragment = 0; -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) if (n < 0) { /* * we may rely on this to get RX, just drop connection @@ -1724,7 +1724,7 @@ drain_extension: goto already_done; if ( -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) n && #endif eff_buf.token_len) diff --git a/lib/server/server-handshake.c b/lib/server/server-handshake.c index f5db7e1af..0cf54919a 100644 --- a/lib/server/server-handshake.c +++ b/lib/server/server-handshake.c @@ -23,7 +23,7 @@ #define LWS_CPYAPP(ptr, str) { strcpy(ptr, str); ptr += strlen(str); } -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) static int lws_extension_server_handshake(struct lws *wsi, char **p, int budget) { @@ -292,7 +292,7 @@ handshake_0405(struct lws_context *context, struct lws *wsi) p += lws_snprintf(p, 128, "%s", wsi->protocol->name); } -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) /* * Figure out which extensions the client has that we want to * enable on this connection, and give him back the list. diff --git a/lib/service.c b/lib/service.c index db9a842de..b484f2633 100644 --- a/lib/service.c +++ b/lib/service.c @@ -80,7 +80,7 @@ lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd) int m, n; volatile struct lws *vwsi = (volatile struct lws *)wsi; -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) struct lws_tokens eff_buf; int ret; #endif @@ -249,7 +249,7 @@ lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd) m = lws_ext_cb_active(wsi, LWS_EXT_CB_IS_WRITEABLE, NULL, 0); if (m) goto bail_die; -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) if (!wsi->extension_data_pending) goto user_service; @@ -1093,7 +1093,7 @@ completed: static int lws_is_ws_with_ext(struct lws *wsi) { -#if defined(LWS_NO_EXTENSIONS) +#if defined(LWS_WITHOUT_EXTENSIONS) return 0; #else return lws_state_is_ws(wsi->state) && !!wsi->count_act_ext; @@ -1789,7 +1789,7 @@ drain: */ m = 0; do { -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) m = lws_ext_cb_active(wsi, LWS_EXT_CB_PACKET_RX_PREPARSE, &eff_buf, 0); if (m < 0) diff --git a/lwsws/main.c b/lwsws/main.c index 4ba017f6e..6efe5c87b 100644 --- a/lwsws/main.c +++ b/lwsws/main.c @@ -59,7 +59,7 @@ void lwsl_emit_stderr(int level, const char *line); #define LWSWS_CONFIG_STRING_SIZE (32 * 1024) static const struct lws_extension exts[] = { -#if !defined(LWS_NO_EXTENSIONS) +#if !defined(LWS_WITHOUT_EXTENSIONS) { "permessage-deflate", lws_extension_callback_pm_deflate, diff --git a/test-apps/android/app/src/main/jni/LwsService.cpp b/test-apps/android/app/src/main/jni/LwsService.cpp index 769011b63..4a568f346 100644 --- a/test-apps/android/app/src/main/jni/LwsService.cpp +++ b/test-apps/android/app/src/main/jni/LwsService.cpp @@ -176,7 +176,7 @@ JNIEXPORT jboolean JNICALL jni_initLws(JNIEnv *env, jobject obj) memset(&info, 0, sizeof(info)); info.port = CONTEXT_PORT_NO_LISTEN; info.protocols = protocols; -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) info.extensions = exts; #endif info.gid = -1; diff --git a/test-apps/test-echo.c b/test-apps/test-echo.c index 81a5076f2..3d3b1ffff 100644 --- a/test-apps/test-echo.c +++ b/test-apps/test-echo.c @@ -439,7 +439,7 @@ int main(int argc, char **argv) if (use_ssl) info.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT; -#ifndef LWS_NO_EXTENSIONS +#if !defined(LWS_WITHOUT_EXTENSIONS) info.extensions = exts; #endif