[master] b1b8947c9 Revert "vrb: Turn BS_TAKEN into a request flag"
Nils Goroll
nils.goroll at uplex.de
Mon Aug 12 13:19:07 UTC 2024
commit b1b8947c92fd7fe6d6d4af26c36fb7bf0fc16259
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Wed Jul 31 20:19:47 2024 +0200
Revert "vrb: Turn BS_TAKEN into a request flag"
This reverts commit f0e9df843d28bb55e9acea9b73ae4ccc658d033f.
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index ef11def8f..185ed67eb 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -141,8 +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->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);
diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index 49179a9d9..fa4b4062b 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -207,7 +207,7 @@ VRB_Iterate(struct worker *wrk, struct vsl_log *vsl,
}
if (req->req_body_status == BS_NONE)
return (0);
- if (req->req_body_taken) {
+ if (req->req_body_status == BS_TAKEN) {
VSLb(vsl, SLT_VCL_Error,
"Uncached req.body can only be consumed once.");
return (-1);
@@ -219,7 +219,7 @@ VRB_Iterate(struct worker *wrk, struct vsl_log *vsl,
}
Lck_Lock(&req->sp->mtx);
if (req->req_body_status->avail > 0) {
- req->req_body_taken = 1;
+ req->req_body_status = BS_TAKEN;
i = 0;
} else
i = -1;
@@ -277,7 +277,6 @@ VRB_Free(struct req *req)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- req->req_body_taken = 0;
if (req->body_oc == NULL) {
AZ(req->req_body_cached);
return;
diff --git a/include/tbl/body_status.h b/include/tbl/body_status.h
index e9464381f..39c45b4fb 100644
--- a/include/tbl/body_status.h
+++ b/include/tbl/body_status.h
@@ -38,6 +38,7 @@ BODYSTATUS(ERROR, error, 1, -1, 0)
BODYSTATUS(CHUNKED, chunked, 2, 1, 0)
BODYSTATUS(LENGTH, length, 3, 1, 1)
BODYSTATUS(EOF, eof, 4, 1, 0)
+BODYSTATUS(TAKEN, taken, 5, 0, 0)
#undef BODYSTATUS
/*lint -restore */
diff --git a/include/tbl/req_flags.h b/include/tbl/req_flags.h
index cee216749..282bd92ea 100644
--- a/include/tbl/req_flags.h
+++ b/include/tbl/req_flags.h
@@ -42,7 +42,6 @@ REQ_FLAG(want100cont, 0, 0, "")
REQ_FLAG(late100cont, 0, 0, "")
REQ_FLAG(req_reset, 0, 0, "")
REQ_FLAG(req_body_cached, 0, 0, "")
-REQ_FLAG(req_body_taken, 0, 0, "")
#define REQ_BEREQ_FLAG(lower, vcl_r, vcl_w, doc) \
REQ_FLAG(lower, vcl_r, vcl_w, doc)
#include "tbl/req_bereq_flags.h"
More information about the varnish-commit
mailing list