[master] b811258ea fetch: Make up an X-Varnish header variable

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Apr 14 15:47:06 UTC 2025


commit b811258ead70da834a38a0b1d91a5ee27d6e6387
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Apr 1 17:51:09 2025 +0200

    fetch: Make up an X-Varnish header variable
    
    It could be part of the well-known headers table, along with the h2
    pseudo-header fields, but that would require an update of the perfect
    hash lookup table.
    
    The main goal so far is to formalize the hdr_t nature of this string.

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index f5a1a1d6a..84db8e947 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -64,6 +64,8 @@ struct fetch_step {
 FETCH_STEPS
 #undef FETCH_STEP
 
+static hdr_t const H_X_Varnish = "\012X-Varnish:";
+
 /*--------------------------------------------------------------------
  * Allocate an object, with fall-back to Transient.
  * XXX: This somewhat overlaps the stuff in stevedore.c
@@ -405,7 +407,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	bo->storage = bo->uncacheable ? stv_transient : STV_next();
 
 	if (bo->retries > 0)
-		http_Unset(bo->bereq, "\012X-Varnish:");
+		http_Unset(bo->bereq, H_X_Varnish);
 
 	http_PrintfHeader(bo->bereq, "X-Varnish: %ju", VXID(bo->vsl->wid));
 


More information about the varnish-commit mailing list