mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
BUG/MEDIUM: cache: Properly copy headers splitted on several shctx blocks
In the cache, huge HTTP headers will use several shctx blocks. When a response is returned from the cache, these headers must be properly copied in the corresponding HTX message by updating the pointer where to copied a header part. This patch must be backported to 2.0 and 1.9.
This commit is contained in:
parent
f1ef7f641d
commit
15a4ce870a
@ -716,6 +716,7 @@ static unsigned int htx_cache_dump_blk(struct appctx *appctx, struct htx *htx, e
|
|||||||
struct cache_flt_conf *cconf = appctx->rule->arg.act.p[0];
|
struct cache_flt_conf *cconf = appctx->rule->arg.act.p[0];
|
||||||
struct shared_context *shctx = shctx_ptr(cconf->c.cache);
|
struct shared_context *shctx = shctx_ptr(cconf->c.cache);
|
||||||
struct htx_blk *blk;
|
struct htx_blk *blk;
|
||||||
|
char *ptr;
|
||||||
unsigned int max, total;
|
unsigned int max, total;
|
||||||
uint32_t blksz;
|
uint32_t blksz;
|
||||||
|
|
||||||
@ -734,12 +735,14 @@ static unsigned int htx_cache_dump_blk(struct appctx *appctx, struct htx *htx, e
|
|||||||
|
|
||||||
blk->info = info;
|
blk->info = info;
|
||||||
total = 4;
|
total = 4;
|
||||||
|
ptr = htx_get_blk_ptr(htx, blk);
|
||||||
while (blksz) {
|
while (blksz) {
|
||||||
max = MIN(blksz, shctx->block_size - offset);
|
max = MIN(blksz, shctx->block_size - offset);
|
||||||
memcpy(htx_get_blk_ptr(htx, blk), (const char *)shblk->data + offset, max);
|
memcpy(ptr, (const char *)shblk->data + offset, max);
|
||||||
offset += max;
|
offset += max;
|
||||||
blksz -= max;
|
blksz -= max;
|
||||||
total += max;
|
total += max;
|
||||||
|
ptr += max;
|
||||||
if (blksz || offset == shctx->block_size) {
|
if (blksz || offset == shctx->block_size) {
|
||||||
shblk = LIST_NEXT(&shblk->list, typeof(shblk), list);
|
shblk = LIST_NEXT(&shblk->list, typeof(shblk), list);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user