]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cache/htx: Be sure to count partial trailers
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Jan 2019 15:15:34 +0000 (16:15 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Jan 2019 15:23:03 +0000 (16:23 +0100)
When a chunked object is served from the cache, If the trailers are not pushed
in the channel's buffer in one time, we still have to count them in the total
written bytes in the buffer.

This patch must be backported to 1.9.

src/cache.c

index d80ee904f9c99d7b6825780275a484c201456d53..77e411f59492e42ce83654680bba46da5b3bcc86 100644 (file)
@@ -1027,12 +1027,12 @@ static void htx_cache_io_handler(struct appctx *appctx)
                unsigned int len = first->len - sizeof(*cache_ptr) - appctx->ctx.cache.sent;
 
                ret = htx_cache_dump_data(appctx, res_htx, HTX_BLK_TLR, len);
+               total += ret;
                if (ret < len) {
                        si_rx_room_blk(si);
                        goto out;
                }
 
-               total += ret;
                if (first->len == sizeof(*cache_ptr) + appctx->ctx.cache.sent)
                        appctx->st0 = HTX_CACHE_EOM;
        }