]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: do not restrict parsing of transfer-encoding to HTTP/1.1
authorWilly Tarreau <w@1wt.eu>
Fri, 1 May 2015 08:06:30 +0000 (10:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 May 2015 11:56:10 +0000 (13:56 +0200)
While Transfer-Encoding is HTTP/1.1, we must still parse it in HTTP/1.0
in case an agent sends it, because it's likely that the other side might
use it as well, causing confusion. This will also result in getting rid
of the Content-Length header in such abnormal situations and in having
a clean connection.

This must be backported to 1.5 and 1.4.

src/proto_http.c

index 4b4d2be9d3ab878456b4523335a5a0c49f3dc78e..7f5df4c9ab218739908adaa19ec38410db8723b0 100644 (file)
@@ -3047,8 +3047,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
        use_close_only = 0;
        ctx.idx = 0;
        /* set TE_CHNK and XFER_LEN only if "chunked" is seen last */
-       while ((msg->flags & HTTP_MSGF_VER_11) &&
-              http_find_header2("Transfer-Encoding", 17, req->buf->p, &txn->hdr_idx, &ctx)) {
+       while (http_find_header2("Transfer-Encoding", 17, req->buf->p, &txn->hdr_idx, &ctx)) {
                if (ctx.vlen == 7 && strncasecmp(ctx.line + ctx.val, "chunked", 7) == 0)
                        msg->flags |= (HTTP_MSGF_TE_CHNK | HTTP_MSGF_XFER_LEN);
                else if (msg->flags & HTTP_MSGF_TE_CHNK) {
@@ -6229,8 +6228,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
 
        use_close_only = 0;
        ctx.idx = 0;
-       while ((msg->flags & HTTP_MSGF_VER_11) &&
-              http_find_header2("Transfer-Encoding", 17, rep->buf->p, &txn->hdr_idx, &ctx)) {
+       while (http_find_header2("Transfer-Encoding", 17, rep->buf->p, &txn->hdr_idx, &ctx)) {
                if (ctx.vlen == 7 && strncasecmp(ctx.line + ctx.val, "chunked", 7) == 0)
                        msg->flags |= (HTTP_MSGF_TE_CHNK | HTTP_MSGF_XFER_LEN);
                else if (msg->flags & HTTP_MSGF_TE_CHNK) {