Header set to NULL by a VMOD: semantic change between 3.0.3 and 3.0.6

Geoff Simmons geoff at uplex.de
Mon Nov 3 18:01:50 CET 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello all,

A conversation on the IRC channel helped to clear up what went on here.

Short version for VCL authors: the way we should expect things to work
is as in the semantics of 3.0.6 (actually as of 3.0.4, apparently).

That is, if you're using a VMOD that may return NULL for a STRING
return type, and assign the return value to a header, then the header
will compare equal to "" if the VMOD returned NULL.

> set req.http.x-foo = vmod.foo(); if (req.http.x-foo == "") { # VMOD
> returned NULL (or empty string) }

This was the issue in ticket #1406:

https://www.varnish-cache.org/trac/ticket/1406

An earlier change that fixed an issue with string concatenation had
the side effect of changing the semantics of truthiness. The decision
in #1406 was to leave things as they are, since another change would
cause even more difficulty.

The change log (changes.rst) mentions this as happening between 3.0.2
and 3.0.3, but apparently the commit actually went into 3.0.4.


Happy VCL-ing!
Geoff
- -- 
** * * UPLEX - Nils Goroll Systemoptimierung

Scheffelstraße 32
22301 Hamburg

Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753

http://uplex.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJUV7T+AAoJEOUwvh9pJNURWn4QAI61zYZ/3YT8QDum4eL7TM8Q
dwJiTd2gOqbdxgCw+UL1JHdb4CGPBxAbPtPG6V9Gy7CY3FMz9V0knnUjvmP6XcbT
sKGmWpLS95MFHigDvTbPhxiOUFalKez0gjwEMtSdb026V3TeCsq8u+n9n5g/h7tC
Cx/0zOt4niSNGIT95jkK3B547r4sSpcvrENs73e0XfNbug9IgpqYm0LikjnRgNP6
pq6BgDk5ZwsmQChi63PnBykKzhMI7ByqICqd6x0e35FiUKaoSwCmI8Sj3zsmv04c
kTKdlGxTNjRTtxFUozCpTS9SJTG1d5eBelyTb4sIJHkOXTvssEu7bE49tQLnq7m3
XhEArWYndCIV8sAz1klscC/aPyWoz0t53l4MVMnlJW+T83+ZV9wRT7c37QYN03jp
YcxvvCN0MYhsXj21aw8Y6UmgAnQHa7g3fvk8PBxlX7n9283EzLW0RSg8i7ifTacQ
/lxr5tOQkzvlazyypz5WyCtHlFP7Kd3WH+Oq+dCCeMQNXSTic/lVsFgzUZfDDnIc
jdfhOsP7sNgX2Plo7dTYBr+attnmWr8hSjEshQBFWu5iE2HD9FTfI5CTDQ4p7m32
izrsNIUIDlHzcsXQxkltPaw7QYrX8CnFp9+3DnFAM756iwW0TtU7x09LPchKLbOI
KFvpa2U74KUfvYnAI03P
=PoTx
-----END PGP SIGNATURE-----



More information about the varnish-misc mailing list