[master] 13b458a80 fix VDP_END in ved_vdp_esi_bytes case 2

Nils Goroll nils.goroll at uplex.de
Fri Oct 9 08:38:06 UTC 2020


commit 13b458a808638451212ccb981715f60fc805b21d
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Oct 8 16:28:44 2020 +0200

    fix VDP_END in ved_vdp_esi_bytes case 2
    
    This only concerns VDP_END at esi_level > 0, which I considered not
    relevant until Martin pointed out that it is.

diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index ff9cf8d29..405aec8e2 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -397,6 +397,8 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
 			}
 			break;
 		case 2:
+			ptr = NULL;
+			len = 0;
 			if (ecx->isgzip && ecx->pecx == NULL) {
 				/*
 				 * We are bytealigned here, so simply emit
@@ -414,15 +416,14 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
 				/* MOD(2^32) length */
 				vle32enc(tailbuf + 9, ecx->l_crc);
 
-				retval = VDP_bytes(vdx, VDP_END, tailbuf, 13);
+				ptr = tailbuf;
+				len = 13;
 			} else if (ecx->pecx != NULL) {
 				ecx->pecx->crc = crc32_combine(ecx->pecx->crc,
 				    ecx->crc, ecx->l_crc);
 				ecx->pecx->l_crc += ecx->l_crc;
-				retval = VDP_bytes(vdx, VDP_FLUSH, NULL, 0);
-			} else {
-				retval = VDP_bytes(vdx, VDP_END, NULL, 0);
 			}
+			retval = VDP_bytes(vdx, VDP_END, ptr, len);
 			ecx->state = 99;
 			return (retval);
 		case 3:
diff --git a/bin/varnishtest/tests/e00034.vtc b/bin/varnishtest/tests/e00034.vtc
index 7050a2048..2749b3df3 100644
--- a/bin/varnishtest/tests/e00034.vtc
+++ b/bin/varnishtest/tests/e00034.vtc
@@ -84,6 +84,7 @@ varnish v1 -syntax 4.1 -vcl+backend {
 				set resp.filters += " rot13";
 			}
 		}
+		set resp.filters += " debug.pedantic";
 	}
 	sub vcl_backend_response {
 		set beresp.do_esi = true;


More information about the varnish-commit mailing list