mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02:00
BUG/MINOR: http-htx: Properly set htx flags on error files to support keep-alive
When an error file was loaded, the flag HTX_SL_F_XFER_LEN was never set on the HTX start line because of a bug. During the headers parsing, the flag H1_MF_XFER_LEN is never set on the h1m. But it was the condition to set HTX_SL_F_XFER_LEN on the HTX start-line. Instead, we must only rely on the flags H1_MF_CLEN or H1_MF_CHNK. Because of this bug, it was impossible to keep a connection alive for a response generated by HAProxy. Now the flag HTX_SL_F_XFER_LEN is set when an error file have a content length (chunked responses are unsupported at this stage) and the connection may be kept alive if there is no connection header specified to explicitly close it. This patch must be backported to 2.0 and 1.9.
This commit is contained in:
parent
abefa34c34
commit
0d4ce93fcf
@ -771,16 +771,13 @@ int http_str_to_htx(struct buffer *buf, struct ist raw)
|
||||
flags |= HTX_SL_F_VER_11;
|
||||
if (h1m.flags & H1_MF_XFER_ENC)
|
||||
flags |= HTX_SL_F_XFER_ENC;
|
||||
if (h1m.flags & H1_MF_XFER_LEN) {
|
||||
flags |= HTX_SL_F_XFER_LEN;
|
||||
if (h1m.flags & H1_MF_CHNK)
|
||||
goto error; /* Unsupported because there is no body parsing */
|
||||
else if (h1m.flags & H1_MF_CLEN) {
|
||||
flags |= HTX_SL_F_CLEN;
|
||||
if (h1m.flags & H1_MF_CLEN) {
|
||||
flags |= (HTX_SL_F_XFER_LEN|HTX_SL_F_CLEN);
|
||||
if (h1m.body_len == 0)
|
||||
flags |= HTX_SL_F_BODYLESS;
|
||||
}
|
||||
}
|
||||
if (h1m.flags & H1_MF_CHNK)
|
||||
goto error; /* Unsupported because there is no body parsing */
|
||||
|
||||
htx = htx_from_buf(buf);
|
||||
sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags, h1sl.st.v, h1sl.st.c, h1sl.st.r);
|
||||
|
Loading…
x
Reference in New Issue
Block a user