]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cache: does not cache if no Content-Length
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 8 Nov 2017 10:25:15 +0000 (11:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 11 Nov 2017 13:01:21 +0000 (14:01 +0100)
In the case of Transfer-Encoding: chunked, there is no Content-Length
which causes the cache to allocate a too small shctx row for the data.

It's not possible to allocate a shctx row for the chunks, we need to be
able to allocate on-the-fly the shctx blocks during the data transfer.

src/cache.c

index 15e221012d3d03b66f30a26fc1b5591d63c0c372..02bb0e048d226e9f24516894e505f108facd6624 100644 (file)
@@ -368,6 +368,10 @@ enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px,
        if (!(txn->req.flags & HTTP_MSGF_VER_11))
                goto out;
 
+       /* does not cache if Content-Length unknown */
+       if (!(msg->flags & HTTP_MSGF_CNT_LEN))
+               goto out;
+
        /* cache only GET method */
        if (txn->meth != HTTP_METH_GET)
                goto out;