On Sun, Nov 1, 2015 at 6:06 PM, Geoff Simmons <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 10/30/2015 05:19 PM, Kacper Wysocki wrote: >> >> slightly related to this, could we possibly allow accessing the >> name in VCL, like >> >> if(req.backend_hint ~ "zool") { /* do something */ } > > If you can wait until vcl_backend_response(), you do have > beresp.backend.name as a string, and this will work: > > if (beresp.backend.name ~ "zool") { > /* do something */ > } > >> or even >> >> std.log("backend was " + req.backend_hint); ? > > That works, try it. Evidently because a STRING_LIST is required in > std.log(), and VCC knows to do implicit string conversions for the > various data types -- it even works without the concatenation. > > A regex match against req.backend_hint or bereq.backend doesn't work > because a STRING is required. IIUC, VCC does implicit string > conversions where a STRING_LIST is expected, but not where a STRING is > expected.
Oh. I hadn't seen req.backend.name. I guess the type conversion is a little counter to my intuition too. thanks, -kacper _______________________________________________ varnish-dev mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
