From: Christopher Faulet Date: Tue, 3 Sep 2019 14:05:31 +0000 (+0200) Subject: BUG/MINOR: h1: Properly reset h1m when parsing is restarted X-Git-Tag: v2.1-dev2~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84f06533e169ce34afad9e48fa6d3b0f614d4ad0;p=thirdparty%2Fhaproxy.git BUG/MINOR: h1: Properly reset h1m when parsing is restarted Otherwise some processing may be performed twice. For instance, if the header "Content-Length" is parsed on the first pass, when the parsing is restarted, we skip it because we think another header with the same value was already seen. In fact, it is currently the only existing bug that can be encountered. But it is safer to reset all the h1m on restart to avoid any future bugs. This patch must be backported to 2.0 and 1.9 --- diff --git a/src/h1.c b/src/h1.c index 957abd5b81..5bd54f6320 100644 --- a/src/h1.c +++ b/src/h1.c @@ -934,7 +934,8 @@ int h1_headers_to_hdr_list(char *start, const char *stop, return -2; restart: - h1m->next = 0; + h1m->flags &= ~(H1_MF_VER_11|H1_MF_CLEN|H1_MF_XFER_ENC|H1_MF_CHNK|H1_MF_CONN_KAL|H1_MF_CONN_CLO|H1_MF_CONN_UPG); + h1m->curr_len = h1m->body_len = h1m->next = 0; if (h1m->flags & H1_MF_RESP) h1m->state = H1_MSG_RPBEFORE; else