http keepalive needs to reinit some header union state

AG moved the code to the keepalive loop location
This commit is contained in:
Carl Stehle 2014-08-16 10:17:59 +08:00 committed by Andy Green
parent b128ccccca
commit 66d466a1a4

View file

@ -173,17 +173,23 @@ read_ok:
http_complete:
lwsl_debug("libwebsocket_read: http_complete\n");
/* Handle keep-alives, by preparing for a new request: */
/* Did the client want to keep the HTTP connection going? */
if (wsi->u.http.connection_type == HTTP_CONNECTION_KEEP_ALIVE) {
lwsl_debug("libwebsocket_read: keep-alive\n");
wsi->state = WSI_STATE_HTTP;
wsi->mode = LWS_CONNMODE_HTTP_SERVING;
/* We might be streaming HTTP content, so leave the connection open.*/
/* He asked for it to stay alive indefinitely */
libwebsocket_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
if (lws_allocate_header_table(wsi))
goto bail;
/* If we're (re)starting on headers, need other implied init */
wsi->u.hdr.ues = URIES_IDLE;
/* If we have more data, loop back around: */
if (len)
goto http_new;