]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http request: simplify the test of no-data
authorWilly Tarreau <w@1wt.eu>
Sun, 18 Oct 2009 19:17:42 +0000 (21:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Oct 2009 19:19:33 +0000 (21:19 +0200)
Now we can rely on (chunked && !hdr_content_len) to stop forwarding
data. We only do that for known methods that are not CONNECT though.

src/proto_http.c

index 5fd52117d547be54c7d61b003651b35c518cf183..a7b29753358a22fa862f2e4fedaf2325e1b5ea56 100644 (file)
@@ -2390,16 +2390,9 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
        }
 
        /* We can shut read side if "connection: close" && !abort_on_close && !content-length */
-       if ((txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD) &&
-           (s->flags & SN_CONN_CLOSED) && !(s->be->options & PR_O_ABRT_CLOSE)) {
-               struct hdr_ctx ctx;
-               ctx.idx = 0;
-               if (!http_find_header2("Transfer-Encoding", 17, msg->sol, &txn->hdr_idx, &ctx)) {
-                       ctx.idx = 0;
-                       if (!http_find_header2("Content-length", 14, msg->sol, &txn->hdr_idx, &ctx))
-                               req->flags |= BF_DONT_READ;
-               }
-       }
+       if ((s->flags & SN_CONN_CLOSED) && !(s->be->options & PR_O_ABRT_CLOSE) &&
+           !(txn->flags & TX_REQ_TE_CHNK) && !txn->req.hdr_content_len && (txn->meth < HTTP_METH_CONNECT))
+               req->flags |= BF_DONT_READ;
 
        /* that's OK for us now, let's move on to next analysers */
        return 1;