[master] 233534e29 vmod_debug: the debug.chunked vdp needs to do one more thing

Nils Goroll nils.goroll at uplex.de
Thu Aug 22 09:32:05 UTC 2024


commit 233534e29c627b73dfa3a3350a2bf89c86a93375
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Aug 22 11:24:34 2024 +0200

    vmod_debug: the debug.chunked vdp needs to do one more thing
    
    cnt_transmit() keeps the existing C-L header only if the value from
    http_GetContentLength() agrees with ObjGetLen(), so, for example, if the
    response does not have a Content-Length header, but the length is known, C-L is
    added again using http_PrintfHeader().
    
    So to force chunked delivery for all cases, we also need to set resp_len to
    "unknown".
    
    Side note: This is actually what I expected to need to do in the first place,
    and I was surprised that only removing C-L already worked. It did, but not
    for all cases.

diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index cea472a09..e78208941 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -196,6 +196,7 @@ xyzzy_vdp_chunked_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore
 	hp = vdc->req->resp;
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 	http_Unset(hp, H_Content_Length);
+	vdc->req->resp_len = -1;
 
 	return (1);
 }


More information about the varnish-commit mailing list