[master] eb85bf87c vrt_filter: Minor polish

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Feb 13 11:34:06 UTC 2025


commit eb85bf87cae0b9feca74a20a1cee2b54a2b06d57
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Feb 13 12:22:39 2025 +0100

    vrt_filter: Minor polish
    
    I'm not convinced by req_filter_can(). Filters have no effect on a
    bereq, beresp or resp without a body, why should it be different for
    req? We should be consistent here.

diff --git a/bin/varnishd/cache/cache_vrt_filter.c b/bin/varnishd/cache/cache_vrt_filter.c
index 18077c220..c3309d77d 100644
--- a/bin/varnishd/cache/cache_vrt_filter.c
+++ b/bin/varnishd/cache/cache_vrt_filter.c
@@ -404,7 +404,7 @@ static const char *
 bereq_Empty_Filter(struct busyobj *bo)
 {
 
-	(void)bo;
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	return ("");
 }
 
@@ -437,6 +437,7 @@ resp_default_filter_list(void *arg, struct vsb *vsb)
 const char *
 resp_Get_Filter_List(struct req *req)
 {
+
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	return (filter_on_ws(req->ws, resp_default_filter_list, req));
 }
@@ -445,15 +446,19 @@ static const char *
 req_Empty_Filter(struct req *req)
 {
 
-	(void)req;
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	return ("");
 }
 
-/*--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ * XXX: why ignore needless filters for everything but req?
+ */
+
 static int
-req_filter_can(struct req *req) {
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+req_filter_can(struct req *req)
+{
 
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	return (req->req_body_status->avail == 1);
 }
 


More information about the varnish-commit mailing list