[master] 7e9a31831 Explain string->boolean better.

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 14 09:33:07 UTC 2019


commit 7e9a31831133d8fe868a0c8ecb846a5e8ac00fa5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 14 09:32:08 2019 +0000

    Explain string->boolean better.
    
    Fixes #2846

diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst
index fbd9cde3f..2f31f4d3f 100644
--- a/doc/sphinx/reference/vcl.rst
+++ b/doc/sphinx/reference/vcl.rst
@@ -93,7 +93,12 @@ Booleans can be either ``true`` or ``false``.  In addition, in a boolean
 context some data types will evaluate to ``true`` or ``false`` depending on
 their value.
 
-String types will evaluate to ``false`` if they are not set; backend types
+String types will evaluate to ``false`` if they are unset.  This allows
+checks of the type ``if (req.http.opthdr) {}`` to test if a header
+exists, even if it is empty, whereas ``if (req.http.opthdr == "") {}``
+does not distinguish if the header does not exist or if it is empty.
+
+Backend types
 will evaluate to ``false`` if they don't have a backend assigned; integer
 types will evaluate to ``false`` if their value is zero; duration types
 will evaluate to ``false`` if their value is equal or less than zero.


More information about the varnish-commit mailing list