[master] 402a969d4 cache_transport: Remove boc argument from vtr_deliver_f
Nils Goroll
nils.goroll at uplex.de
Mon Nov 25 17:30:04 UTC 2024
commit 402a969d45773c1fff3e4705e362686b6830a82d
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri Nov 1 15:55:55 2024 +0100
cache_transport: Remove boc argument from vtr_deliver_f
now that boc lives in struct req, it is obsolete
also change some subordinate helper functions
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index c4063f355..158251337 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -855,9 +855,9 @@ static const struct vdp ved_ved = {
};
static void
-ved_close(struct req *req, struct boc *boc, int error)
+ved_close(struct req *req, int error)
{
- req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, boc);
+ req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, req->boc);
if (! error)
return;
@@ -868,7 +868,7 @@ ved_close(struct req *req, struct boc *boc, int error)
/*--------------------------------------------------------------------*/
static void v_matchproto_(vtr_deliver_f)
-ved_deliver(struct req *req, struct boc *boc, int wantbody)
+ved_deliver(struct req *req, int wantbody)
{
int i = 0;
const char *p;
@@ -878,7 +878,7 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
struct vrt_ctx ctx[1];
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- CHECK_OBJ_ORNULL(boc, BOC_MAGIC);
+ CHECK_OBJ_ORNULL(req->boc, BOC_MAGIC);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC);
@@ -887,17 +887,17 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
if (FEATURE(FEATURE_ESI_INCLUDE_ONERROR) &&
status != 200 && status != 204) {
- ved_close(req, boc, ecx->abrt);
+ ved_close(req, ecx->abrt);
return;
}
if (wantbody == 0) {
- ved_close(req, boc, 0);
+ ved_close(req, 0);
return;
}
- if (boc == NULL && ObjGetLen(req->wrk, req->objcore) == 0) {
- ved_close(req, boc, 0);
+ if (req->boc == NULL && ObjGetLen(req->wrk, req->objcore) == 0) {
+ ved_close(req, 0);
return;
}
@@ -913,7 +913,7 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
/* A gzipped include which is not ESI processed */
/* OA_GZIPBITS are not valid until BOS_FINISHED */
- if (boc != NULL)
+ if (req->boc != NULL)
ObjWaitState(req->objcore, BOS_FINISHED);
if (req->objcore->flags & OC_F_FAILED) {
@@ -921,7 +921,7 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
* the ESI body. Omit this ESI fragment.
* XXX change error argument to 1
*/
- ved_close(req, boc, 0);
+ ved_close(req, 0);
return;
}
@@ -947,5 +947,5 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
if (i && req->doclose == SC_NULL)
req->doclose = SC_REM_CLOSE;
- ved_close(req, boc, i && ecx->abrt ? 1 : 0);
+ ved_close(req, i && ecx->abrt ? 1 : 0);
}
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 56b15fcd4..a167b2839 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -497,7 +497,7 @@ cnt_transmit(struct worker *wrk, struct req *req)
}
if (req->resp_len == 0)
sendbody = 0;
- req->transport->deliver(req, req->boc, sendbody);
+ req->transport->deliver(req, sendbody);
}
VSLb_ts_req(req, "Resp", W_TIM_real(wrk));
diff --git a/bin/varnishd/cache/cache_transport.h b/bin/varnishd/cache/cache_transport.h
index 701f0dbfd..d5cd3d428 100644
--- a/bin/varnishd/cache/cache_transport.h
+++ b/bin/varnishd/cache/cache_transport.h
@@ -38,7 +38,7 @@
struct req;
struct boc;
-typedef void vtr_deliver_f (struct req *, struct boc *, int sendbody);
+typedef void vtr_deliver_f (struct req *, int sendbody);
typedef void vtr_req_body_f (struct req *);
typedef void vtr_sess_panic_f (struct vsb *, const struct sess *);
typedef void vtr_req_panic_f (struct vsb *, const struct req *);
diff --git a/bin/varnishd/http1/cache_http1.h b/bin/varnishd/http1/cache_http1.h
index 98ed1e1df..7aadb5cfa 100644
--- a/bin/varnishd/http1/cache_http1.h
+++ b/bin/varnishd/http1/cache_http1.h
@@ -42,7 +42,7 @@ extern const int HTTP1_Req[3];
extern const int HTTP1_Resp[3];
/* cache_http1_deliver.c */
-void V1D_Deliver(struct req *, struct boc *, int sendbody);
+void V1D_Deliver(struct req *, int sendbody);
/* cache_http1_pipe.c */
struct v1p_acct {
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 462a9357f..ab3826a92 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -40,7 +40,7 @@
/*--------------------------------------------------------------------*/
static void
-v1d_error(struct req *req, struct boc *boc, struct v1l **v1lp, const char *msg)
+v1d_error(struct req *req, struct v1l **v1lp, const char *msg)
{
static const char r_500[] =
"HTTP/1.1 500 Internal Server Error\r\n"
@@ -61,14 +61,14 @@ v1d_error(struct req *req, struct boc *boc, struct v1l **v1lp, const char *msg)
VTCP_Assert(write(req->sp->fd, r_500, sizeof r_500 - 1));
req->doclose = SC_TX_EOF;
- req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, boc);
+ req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, req->boc);
}
/*--------------------------------------------------------------------
*/
void v_matchproto_(vtr_deliver_f)
-V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
+V1D_Deliver(struct req *req, int sendbody)
{
struct vrt_ctx ctx[1];
int err = 0, chunked = 0;
@@ -77,7 +77,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
struct v1l *v1l;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- CHECK_OBJ_ORNULL(boc, BOC_MAGIC);
+ CHECK_OBJ_ORNULL(req->boc, BOC_MAGIC);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
if (req->doclose == SC_NULL &&
@@ -98,7 +98,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
cache_param->http1_iovs);
if (v1l == NULL) {
- v1d_error(req, boc, &v1l, "Failure to init v1d (workspace_thread overflow)");
+ v1d_error(req, &v1l, "Failure to init v1d (workspace_thread overflow)");
return;
}
@@ -115,23 +115,23 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
INIT_OBJ(ctx, VRT_CTX_MAGIC);
VCL_Req2Ctx(ctx, req);
if (VDP_Push(ctx, req->vdc, req->ws, VDP_v1l, v1l)) {
- v1d_error(req, boc, &v1l, "Failure to push v1d processor");
+ v1d_error(req, &v1l, "Failure to push v1d processor");
return;
}
}
if (WS_Overflowed(req->ws)) {
- v1d_error(req, boc, &v1l, "workspace_client overflow");
+ v1d_error(req, &v1l, "workspace_client overflow");
return;
}
if (WS_Overflowed(req->sp->ws)) {
- v1d_error(req, boc, &v1l, "workspace_session overflow");
+ v1d_error(req, &v1l, "workspace_session overflow");
return;
}
if (WS_Overflowed(req->wrk->aws)) {
- v1d_error(req, boc, &v1l, "workspace_thread overflow");
+ v1d_error(req, &v1l, "workspace_thread overflow");
return;
}
@@ -150,7 +150,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
sc = V1L_Close(&v1l, &bytes);
req->acct.resp_hdrbytes += hdrbytes;
- req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, boc);
+ req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, req->boc);
if (sc == SC_NULL && err && req->sp->fd >= 0)
sc = SC_REM_CLOSE;
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 4c2f80480..b80b91924 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -293,7 +293,7 @@ h2_build_headers(struct vsb *resp, struct req *req)
}
void v_matchproto_(vtr_deliver_f)
-h2_deliver(struct req *req, struct boc *boc, int sendbody)
+h2_deliver(struct req *req, int sendbody)
{
size_t sz;
const char *r;
@@ -304,7 +304,6 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
uintptr_t ss;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- CHECK_OBJ_ORNULL(boc, BOC_MAGIC);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
CAST_OBJ_NOTNULL(r2, req->transport_priv, H2_REQ_MAGIC);
sp = req->sp;
@@ -349,5 +348,5 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
(void)VDP_DeliverObj(req->vdc, req->objcore);
}
- req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, boc);
+ req->acct.resp_bodybytes += VDP_Close(req->vdc, req->objcore, req->boc);
}
More information about the varnish-commit
mailing list