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
This commit is contained in:
Christopher Faulet 2019-09-03 16:05:31 +02:00
parent 3499f62b59
commit 84f06533e1

View File

@ -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