]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: h2: don't report an error after parsing a 100-continue response
authorWilly Tarreau <w@1wt.eu>
Wed, 29 Nov 2017 14:41:32 +0000 (15:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 29 Nov 2017 14:41:32 +0000 (15:41 +0100)
Yves Lafon reported a breakage with 100-continue. In fact the problem
is caused when an 1xx is the last response in the buffer (which commonly
is the case). We loop back immediately into the parser with what remains
of the input buffer (ie: nothing), while it is not expected to be called
with an empty response, so it fails.

Let's simply get back to the caller to decide whether or not more data
are expected to be sent.

This fix needs to be backported to 1.8.

src/mux_h2.c

index 6857c8d720d9b4da9313ea6c68a4c9459dd1f6c2..4567b8ff04ece1f721735f070d34ff21ffcd382e 100644 (file)
@@ -2800,10 +2800,11 @@ static int h2s_frt_make_resp_headers(struct h2s *h2s, struct buffer *buf)
                        h2s->st = H2_SS_CLOSED;
        }
        else if (h1m->status >= 100 && h1m->status < 200) {
+               /* we'll let the caller check if it has more headers to send */
                h1m->state = HTTP_MSG_RPBEFORE;
                h1m->status = 0;
                h1m->flags = 0;
-               goto next_header_block;
+               goto end;
        }
        else
                h1m->state = (h1m->flags & H1_MF_CLEN) ? HTTP_MSG_BODY : HTTP_MSG_CHUNK_SIZE;