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.

(cherry picked from commit 15a4ce870a19bdb6e6ed0a210d844178145de1b3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/cache.c b/src/cache.c
index d46a8bb..d23fe35 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -899,6 +899,7 @@
 	struct cache_flt_conf *cconf = appctx->rule->arg.act.p[0];
 	struct shared_context *shctx = shctx_ptr(cconf->c.cache);
 	struct htx_blk *blk;
+	char *ptr;
 	unsigned int max, total;
 	uint32_t blksz;
 
@@ -917,12 +918,14 @@
 
 	blk->info = info;
 	total = 4;
+	ptr = htx_get_blk_ptr(htx, blk);
 	while (blksz) {
 		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;
 		blksz  -= max;
 		total  += max;
+		ptr    += max;
 		if (blksz || offset == shctx->block_size) {
 			shblk = LIST_NEXT(&shblk->list, typeof(shblk), list);
 			offset = 0;