From edfab442716e315b2b7930698fd1948a0ac6051d Mon Sep 17 00:00:00 2001 From: Andrew Canaday Date: Wed, 6 Aug 2014 08:58:23 -0400 Subject: [PATCH] Reset hdr_parsing_completed for WSI_STATE_HTTP: This fixes a bug where a client issues two GET requests on the same connection (keep-alive). If the second request is split into two reads, the hdr_parsing_complete flag gets us into trouble by ending the request read two early and giving us bogus data. --- lib/handshake.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/handshake.c b/lib/handshake.c index 421494a25..5dd0d774a 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -68,6 +68,7 @@ libwebsocket_read(struct libwebsocket_context *context, switch (wsi->state) { http_new: case WSI_STATE_HTTP: + wsi->hdr_parsing_completed = 0; case WSI_STATE_HTTP_ISSUING_FILE: wsi->state = WSI_STATE_HTTP_HEADERS; wsi->u.hdr.parser_state = WSI_TOKEN_NAME_PART;