Header set to NULL by a VMOD: semantic change between 3.0.3 and 3.0.6
Carlos Abalde
carlos.abalde at gmail.com
Mon Nov 3 15:43:14 CET 2014
> On Nov 3, 2014, at 3:21 PM, Geoff Simmons <geoff at uplex.de> wrote:
>
> Hello all,
>
> We're presently testing an upgrade from Varnish 3.0.3 to 3.0.6, and have
> encountered a change in the semantics of a header evaluated in boolean
> context after the header has been set to NULL by a VMOD.
Hi,
I can confirm that I've also experienced that behavior when upgrading some VMODs from 3.0.3 to a greater version. In the past, assigning a NULL value returned by a VMOD function to a header in the req, bereq, etc. object removed the header itself. After 3.0.3 the header is created containing an empty string.
Therefore, the following VCL code in 3.0.3:
set req.http.x-foo = vmod.foo();
if (!req.http.x-foo) {
# VMOD returned NULL.
}
if (!vmod.foo()) {
# VMOD returned NULL.
}
Should be replaced after 3.0.3 with something like:
set req.http.x-foo = vmod.foo();
if (req.http.x-foo != "") {
# VMOD returned NULL.
}
if (!vmod.foo()) {
# VMOD returned NULL.
}
VTC files should be adapted in a similar way.
Cheers,
--
Carlos Abalde.
More information about the varnish-misc
mailing list