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/test-server/test-client.c b/test-server/test-client.c
index 919f258..348196b 100644
--- a/test-server/test-client.c
+++ b/test-server/test-client.c
@@ -109,7 +109,8 @@
 {
 	unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 4096 +
 						  LWS_SEND_BUFFER_POST_PADDING];
-	int l;
+	int l = 0;
+	int n;
 
 	switch (reason) {
 
@@ -134,7 +135,8 @@
 
 	case LWS_CALLBACK_CLIENT_WRITEABLE:
 
-		l = sprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING],
+		for (n = 0; n < 1; n++)
+			l += sprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING + l],
 					"c #%06X %d %d %d;",
 					(int)random() & 0xffffff,
 					(int)random() % 500,
@@ -258,7 +260,12 @@
 	 */
 
 	context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
-				protocols, libwebsocket_internal_extensions,
+				protocols,
+#ifndef LWS_NO_EXTENSIONS
+				libwebsocket_internal_extensions,
+#else
+				NULL,
+#endif
 				NULL, NULL, NULL, -1, -1, 0, NULL);
 	if (context == NULL) {
 		fprintf(stderr, "Creating libwebsocket context failed\n");
diff --git a/test-server/test-fraggle.c b/test-server/test-fraggle.c
index 2e899de..abff7bc 100644
--- a/test-server/test-fraggle.c
+++ b/test-server/test-fraggle.c
@@ -306,7 +306,11 @@
 		cert_path = key_path = NULL;
 
 	context = libwebsocket_create_context(server_port, interface, protocols,
+#ifndef LWS_NO_EXTENSIONS
 				libwebsocket_internal_extensions,
+#else
+				NULL,
+#endif
 				cert_path, key_path, NULL, -1, -1, opts, NULL);
 	if (context == NULL) {
 		fprintf(stderr, "libwebsocket init failed\n");
diff --git a/test-server/test-ping.c b/test-server/test-ping.c
index d768df1..773b792 100644
--- a/test-server/test-ping.c
+++ b/test-server/test-ping.c
@@ -409,7 +409,11 @@
 
 	context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
 					      protocols,
-					      libwebsocket_internal_extensions,
+#ifndef LWS_NO_EXTENSIONS
+				libwebsocket_internal_extensions,
+#else
+				NULL,
+#endif
 					      NULL, NULL, NULL, -1, -1, 0, NULL);
 	if (context == NULL) {
 		fprintf(stderr, "Creating libwebsocket context failed\n");
diff --git a/test-server/test-server.c b/test-server/test-server.c
index dc5a9cd..c07a9b9 100644
--- a/test-server/test-server.c
+++ b/test-server/test-server.c
@@ -323,7 +323,7 @@
 
 /* lws-mirror_protocol */
 
-#define MAX_MESSAGE_QUEUE 64
+#define MAX_MESSAGE_QUEUE 128
 
 struct per_session_data__lws_mirror {
 	struct libwebsocket *wsi;
@@ -362,7 +362,7 @@
 	case LWS_CALLBACK_SERVER_WRITEABLE:
 		if (close_testing)
 			break;
-		if (pss->ringbuffer_tail != ringbuffer_head) {
+		while (pss->ringbuffer_tail != ringbuffer_head) {
 
 			n = libwebsocket_write(wsi, (unsigned char *)
 				   ringbuffer[pss->ringbuffer_tail].payload +
@@ -380,16 +380,17 @@
 				pss->ringbuffer_tail++;
 
 			if (((ringbuffer_head - pss->ringbuffer_tail) &
-				  (MAX_MESSAGE_QUEUE - 1)) < (MAX_MESSAGE_QUEUE - 15)) {
+				  (MAX_MESSAGE_QUEUE - 1)) == (MAX_MESSAGE_QUEUE - 15)) {
 				for (n = 0; n < num_wsi_choked; n++)
 					libwebsocket_rx_flow_control(wsi_choked[n], 1);
 				num_wsi_choked = 0;
 			}
+			// lwsl_debug("tx fifo %d\n", (ringbuffer_head - pss->ringbuffer_tail) & (MAX_MESSAGE_QUEUE - 1));
 
-//			lwsl_debug("tx fifo %d\n", (ringbuffer_head - pss->ringbuffer_tail) & (MAX_MESSAGE_QUEUE - 1));
-
-			libwebsocket_callback_on_writable(context, wsi);
-
+			if (lws_send_pipe_choked(wsi)) {
+				libwebsocket_callback_on_writable(context, wsi);
+				return 0;
+			}
 		}
 		break;
 
@@ -422,7 +423,7 @@
 			ringbuffer_head++;
 
 		if (((ringbuffer_head - pss->ringbuffer_tail) &
-				  (MAX_MESSAGE_QUEUE - 1)) < (MAX_MESSAGE_QUEUE - 10))
+				  (MAX_MESSAGE_QUEUE - 1)) != (MAX_MESSAGE_QUEUE - 2))
 			goto done;
 
 choke:
@@ -586,7 +587,11 @@
 		cert_path = key_path = NULL;
 
 	context = libwebsocket_create_context(port, interface, protocols,
+#ifndef LWS_NO_EXTENSIONS
 				libwebsocket_internal_extensions,
+#else
+				NULL,
+#endif
 				cert_path, key_path, NULL, -1, -1, opts, NULL);
 	if (context == NULL) {
 		lwsl_err("libwebsocket init failed\n");