[master] ecddfd74c Reapply "fetch: A beresp body cannot be BS_TAKEN"
Nils Goroll
nils.goroll at uplex.de
Fri Feb 14 20:08:09 UTC 2025
commit ecddfd74c8a0e6ff310da9945f5bf49ad5523c18
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Fri Feb 14 16:45:48 2025 +0100
Reapply "fetch: A beresp body cannot be BS_TAKEN"
This reverts commit 8c4ae4f0e1c1990a48884b36e2b3e9acc8d162a1.
I dispute the claim from the revert commit that bo->htc->body_status
refers to the bereq, since this is managed by the V1F (HTTP/1 Fetch)
code. What we fetch on the backend side is a beresp.
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 196817512..2f67446b6 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