[master] f4b045031 fetch: A beresp body cannot be BS_TAKEN

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jul 3 09:39:05 UTC 2024


commit f4b045031cbd343fabca4e7d8ef0a7e14c4dbb62
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Jun 24 17:24:30 2024 +0200

    fetch: A beresp body cannot be BS_TAKEN
    
    This state is only used to determine whether a req body can be reused
    for a VCL retry.

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 0f86d0305..b78566a69 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -141,10 +141,11 @@ Bereq_Rollback(VRT_CTX)
 	bo = ctx->bo;
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 
-	if (bo->htc != NULL &&
-	    bo->htc->body_status != BS_NONE &&
-	    bo->htc->body_status != BS_TAKEN)
-		bo->htc->doclose = SC_RESP_CLOSE;
+	if (bo->htc != NULL) {
+		assert(bo->htc->body_status != BS_TAKEN);
+		if (bo->htc->body_status != BS_NONE)
+			bo->htc->doclose = SC_RESP_CLOSE;
+	}
 
 	vbf_cleanup(bo);
 	VCL_TaskLeave(ctx, bo->privs);


More information about the varnish-commit mailing list