BUG/MEDIUM: mux-h1: Don't add "transfer-encoding" if message-body is forbidden
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Jan 2019 20:55:21 +0000 (21:55 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 31 Jan 2019 10:07:17 +0000 (11:07 +0100)
commit3949c9d90d0328bbe34578e9ac6768a4f2c5615a
tree91066e3c700c3b7fdca5e40dd13c02e47563a2f5
parent04636b7baca1bd03191c30bc173c19fede73c048
BUG/MEDIUM: mux-h1: Don't add "transfer-encoding" if message-body is forbidden

When a HTTP/1.1 or above response is emitted to a client, if the flag
H1_MF_XFER_LEN is set whereas H1_MF_CLEN and H1_MF_CHNK are not, the header
"transfer-encoding" is added. It is a way to make HTX chunking consistent with
H2. But we must exclude all cases where the message-body is explicitly forbidden
by the RFC:

 * for all 1XX, 204 and 304 responses
 * for any responses to HEAD requests
 * for 200 responses to CONNECT requests

For these 3 cases, the flag H1_MF_XFER_LEN is set but H1_MF_CLEN and H1_MF_CHNK
not. And the header "transfer-encoding" must not be added.

See issue #27 on github for details about the bug.

This patch must be backported in 1.9.
src/mux_h1.c