From: Willy Tarreau Date: Tue, 22 Dec 2009 08:59:58 +0000 (+0100) Subject: [MINOR] http: only consider chunk encoding with HTTP/1.1 X-Git-Tag: v1.4-dev5~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e13c3c6307efe824bfc8d7ed9592733fcbc3406;p=thirdparty%2Fhaproxy.git [MINOR] http: only consider chunk encoding with HTTP/1.1 This must be ignored in case of HTTP/1.0. --- diff --git a/src/proto_http.c b/src/proto_http.c index d232148b62..02be35ce1b 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -2100,9 +2100,9 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit) * required) if it wishes to insist on receiving a valid Content-Length. */ - /* FIXME: chunked encoding is HTTP/1.1 only */ ctx.idx = 0; - while (http_find_header2("Transfer-Encoding", 17, msg->sol, &txn->hdr_idx, &ctx)) { + while ((txn->flags & TX_REQ_VER_11) && + http_find_header2("Transfer-Encoding", 17, msg->sol, &txn->hdr_idx, &ctx)) { if (ctx.vlen == 8 && strncasecmp(ctx.line + ctx.val, "identity", 8) == 0) continue; txn->flags |= TX_REQ_TE_CHNK; @@ -2792,7 +2792,7 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit) /* If we have HTTP/1.1 and Expect: 100-continue, then we must * send an HTTP/1.1 100 Continue intermediate response. */ - if ((likely(msg->sl.rq.v_l == 8) && req->data[msg->som + msg->sl.rq.v + 7] == '1')) { + if (txn->flags & TX_REQ_VER_11) { struct hdr_ctx ctx; ctx.idx = 0; /* Expect is allowed in 1.1, look for it */ @@ -3193,9 +3193,9 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit) txn->status == 204 || txn->status == 304) goto skip_content_length; - /* FIXME: chunked encoding is HTTP/1.1 only */ ctx.idx = 0; - while (http_find_header2("Transfer-Encoding", 17, msg->sol, &txn->hdr_idx, &ctx)) { + while ((txn->flags & TX_RES_VER_11) && + http_find_header2("Transfer-Encoding", 17, msg->sol, &txn->hdr_idx, &ctx)) { if (ctx.vlen == 8 && strncasecmp(ctx.line + ctx.val, "identity", 8) == 0) continue; txn->flags |= TX_RES_TE_CHNK;