[master] 7665152c7 cache_http1_fetch: Further simplify V1F_SendReq() error handling

Nils Goroll nils.goroll at uplex.de
Thu Oct 31 08:51:07 UTC 2024


commit 7665152c705810e675530d1dd630b713c9e54d3b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Oct 31 09:48:34 2024 +0100

    cache_http1_fetch: Further simplify V1F_SendReq() error handling

diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index cb847f1be..3e1c8507a 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -69,7 +69,7 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr_hdrbytes,
 	ssize_t i;
 	uint64_t bytes, hdrbytes;
 	struct http_conn *htc;
-	struct vdp_ctx vdc[1];
+	struct vdp_ctx vdc[1] = { 0 };
 	intmax_t cl;
 	const char *err = NULL;
 
@@ -106,15 +106,16 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr_hdrbytes,
 		 * XXX: need a send_timeout for the backend side
 		 * XXX: use cache_param->http1_iovs ?
 		 */
-		(void) VDP_Close(vdc, NULL, NULL);
 		err = "Failure to open V1L (workspace_thread overflow)";
 	}
-	else if (v1f_stackv1l(vdc, bo)) {
-		(void) V1L_Close(wrk, &bytes);
-		(void) VDP_Close(vdc, NULL, NULL);
+	else if (v1f_stackv1l(vdc, bo))
 		err = "Failure to push V1L";
-	}
+
 	if (err != NULL) {
+		if (wrk->v1l != NULL)
+			(void) V1L_Close(wrk, &bytes);
+		if (vdc->magic != 0)
+			(void) VDP_Close(vdc, NULL, NULL);
 		VSLb(bo->vsl, SLT_FetchError, "%s", err);
 		VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk));
 		htc->doclose = SC_OVERLOAD;


More information about the varnish-commit mailing list