introduce without extensions
The new --without-extensions config flag completely removes all code
and data related to extensions from the build throughout the library
when given.
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/parsers.c b/lib/parsers.c
index 5168471..c503534 100644
--- a/lib/parsers.c
+++ b/lib/parsers.c
@@ -605,8 +605,10 @@
int n;
unsigned char buf[20 + 4];
struct lws_tokens eff_buf;
+#ifndef LWS_NO_EXTENSIONS
int handled;
int m;
+#endif
#if 0
lwsl_debug("RX: %02X ", c);
@@ -1012,6 +1014,7 @@
case LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED:
+
if (wsi->ietf_spec_revision < 4 ||
(wsi->all_zero_nonce && wsi->ietf_spec_revision >= 5))
wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING +
@@ -1080,7 +1083,7 @@
break;
default:
-
+#ifndef LWS_NO_EXTENSIONS
lwsl_parser("passing opcode %x up to exts\n", wsi->opcode);
/*
@@ -1106,6 +1109,7 @@
}
if (!handled)
+#endif
lwsl_ext("Unhandled extended opcode "
"0x%x - ignoring frame\n", wsi->opcode);
@@ -1122,7 +1126,7 @@
eff_buf.token = &wsi->rx_user_buffer[
LWS_SEND_BUFFER_PRE_PADDING];
eff_buf.token_len = wsi->rx_user_buffer_head;
-
+#ifndef LWS_NO_EXTENSIONS
for (n = 0; n < wsi->count_active_extensions; n++) {
m = wsi->active_extensions[n]->callback(
wsi->protocol->owning_server,
@@ -1137,7 +1141,7 @@
return -1;
}
}
-
+#endif
if (eff_buf.token_len > 0) {
eff_buf.token[eff_buf.token_len] = '\0';
@@ -1175,7 +1179,7 @@
int clear_rxflow = !!wsi->rxflow_buffer;
struct libwebsocket_context *context = wsi->protocol->owning_server;
-#ifdef DEBUG
+#if 0
lwsl_parser("received %d byte packet\n", (int)len);
lwsl_hexdump(buf, len);
#endif