> On Nov 3, 2014, at 3:21 PM, Geoff Simmons <[email protected]> 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.
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to