diff --git a/include/haproxy/h1.h b/include/haproxy/h1.h index 7ebd9c84b..1891c81ce 100644 --- a/include/haproxy/h1.h +++ b/include/haproxy/h1.h @@ -99,6 +99,14 @@ enum h1m_state { #define H1_MF_TE_CHUNKED 0x00010000 // T-E "chunked" #define H1_MF_TE_OTHER 0x00020000 // T-E other than supported ones found (only "chunked" is supported for now) +/* Mask to use to reset H1M flags when we restart headers parsing. + * + * WARNING: Don't forget to update it if a new flag must be preserved when + * headers parsing is restarted. + */ +#define H1_MF_RESTART_MASK (H1_MF_RESP|H1_MF_TOLOWER|H1_MF_NO_PHDR|H1_MF_HDRS_ONLY| \ + H1_MF_CLEAN_CONN_HDR|H1_MF_METH_CONNECT|H1_MF_METH_HEAD) + /* Note: for a connection to be persistent, we need this for the request : * - one of CLEN or CHNK * - version 1.0 and KAL and not CLO diff --git a/src/h1.c b/src/h1.c index 99b9c2993..dd208f323 100644 --- a/src/h1.c +++ b/src/h1.c @@ -1040,7 +1040,7 @@ int h1_headers_to_hdr_list(char *start, const char *stop, return -2; restart: - 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->flags &= H1_MF_RESTART_MASK; h1m->curr_len = h1m->body_len = h1m->next = 0; if (h1m->flags & H1_MF_RESP) h1m->state = H1_MSG_RPBEFORE;