http1.1 keepalive drop ah betweentimes
authorAndy Green <andy.green@linaro.org>
Fri, 29 Jan 2016 01:06:22 +0000 (09:06 +0800)
committerAndy Green <andy.green@linaro.org>
Fri, 29 Jan 2016 01:06:22 +0000 (09:06 +0800)
https://github.com/warmcat/libwebsockets/issues/404

Tested with

wget -O- http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html

and confirm no connection processing during that on server side

Signed-off-by: Andy Green <andy.green@linaro.org>
lib/server.c

index 564a2c4..2009bf1 100644 (file)
@@ -691,8 +691,11 @@ lws_http_transaction_completed(struct lws *wsi)
        /* He asked for it to stay alive indefinitely */
        lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
 
-       if (lws_allocate_header_table(wsi))
-               lwsl_info("On waiting list for header table");
+       /* if we still have the headers, drop them and reacquire a new ah when
+        * the new headers arrive.  Otherwise we hog an ah indefinitely,
+        * needlessly.
+        */
+       lws_free_header_table(wsi);
 
        /* If we're (re)starting on headers, need other implied init */
        wsi->u.hdr.ues = URIES_IDLE;