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;