Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-objvar
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
uplex-varnish
varnish-objvar
Commits
9c068644
Unverified
Commit
9c068644
authored
Jun 19, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use $Restrict
parent
b8d7bb72
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
413 additions
and
80 deletions
+413
-80
vmod_topvar.rst
src/vmod_topvar.rst
+376
-17
vmod_topvar.vcctpl
src/vmod_topvar.vcctpl
+7
-1
vmod_topvar.vtctpl
src/vtc/vmod_topvar.vtctpl
+30
-62
No files found.
src/vmod_topvar.rst
View file @
9c068644
...
...
@@ -301,6 +301,10 @@ ACL xacl.get([ACL fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. Using .get() on an undefined value without a fallback triggers a VCL error.
Restricted to: ``client``.
.. _xacl.set():
VOID xacl.set(ACL)
...
...
@@ -310,6 +314,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xacl.undefine():
VOID xacl.undefine()
...
...
@@ -317,6 +325,10 @@ VOID xacl.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xacl.defined():
BOOL xacl.defined()
...
...
@@ -324,6 +336,10 @@ BOOL xacl.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xacl.protect():
VOID xacl.protect()
...
...
@@ -332,6 +348,10 @@ VOID xacl.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xacl.protected():
BOOL xacl.protected()
...
...
@@ -339,6 +359,10 @@ BOOL xacl.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.backend():
new xbackend = topvar.backend([BACKEND init])
...
...
@@ -356,6 +380,10 @@ BACKEND xbackend.get([BACKEND fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is the ``None`` backend.
Restricted to: ``client``.
.. _xbackend.set():
VOID xbackend.set(BACKEND)
...
...
@@ -365,6 +393,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xbackend.undefine():
VOID xbackend.undefine()
...
...
@@ -372,6 +404,10 @@ VOID xbackend.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xbackend.defined():
BOOL xbackend.defined()
...
...
@@ -379,6 +415,10 @@ BOOL xbackend.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xbackend.protect():
VOID xbackend.protect()
...
...
@@ -387,6 +427,10 @@ VOID xbackend.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xbackend.protected():
BOOL xbackend.protected()
...
...
@@ -394,6 +438,10 @@ BOOL xbackend.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.blob():
new xblob = topvar.blob([BLOB init])
...
...
@@ -411,6 +459,10 @@ BLOB xblob.get([BLOB fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is the null blob.
Restricted to: ``client``.
.. _xblob.set():
VOID xblob.set(BLOB)
...
...
@@ -420,6 +472,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xblob.undefine():
VOID xblob.undefine()
...
...
@@ -427,6 +483,10 @@ VOID xblob.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xblob.defined():
BOOL xblob.defined()
...
...
@@ -434,6 +494,10 @@ BOOL xblob.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xblob.protect():
VOID xblob.protect()
...
...
@@ -442,6 +506,10 @@ VOID xblob.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xblob.protected():
BOOL xblob.protected()
...
...
@@ -449,6 +517,10 @@ BOOL xblob.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.body():
new xbody = topvar.body([BODY init])
...
...
@@ -466,6 +538,10 @@ BODY xbody.get([BODY fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. Using .get() on an undefined value without a fallback triggers a VCL error.
Restricted to: ``client``.
.. _xbody.set():
VOID xbody.set(BODY)
...
...
@@ -475,6 +551,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xbody.undefine():
VOID xbody.undefine()
...
...
@@ -482,6 +562,10 @@ VOID xbody.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xbody.defined():
BOOL xbody.defined()
...
...
@@ -489,6 +573,10 @@ BOOL xbody.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xbody.protect():
VOID xbody.protect()
...
...
@@ -497,6 +585,10 @@ VOID xbody.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xbody.protected():
BOOL xbody.protected()
...
...
@@ -504,6 +596,10 @@ BOOL xbody.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.bool():
new xbool = topvar.bool([BOOL init])
...
...
@@ -521,6 +617,10 @@ BOOL xbool.get([BOOL fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is false
Restricted to: ``client``.
.. _xbool.set():
VOID xbool.set(BOOL)
...
...
@@ -530,6 +630,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xbool.undefine():
VOID xbool.undefine()
...
...
@@ -537,6 +641,10 @@ VOID xbool.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xbool.defined():
BOOL xbool.defined()
...
...
@@ -544,6 +652,10 @@ BOOL xbool.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xbool.protect():
VOID xbool.protect()
...
...
@@ -552,6 +664,10 @@ VOID xbool.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xbool.protected():
BOOL xbool.protected()
...
...
@@ -559,6 +675,10 @@ BOOL xbool.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.bytes():
new xbytes = topvar.bytes([BYTES init])
...
...
@@ -576,6 +696,10 @@ BYTES xbytes.get([BYTES fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is 0 bytes.
Restricted to: ``client``.
.. _xbytes.set():
VOID xbytes.set(BYTES)
...
...
@@ -585,6 +709,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xbytes.undefine():
VOID xbytes.undefine()
...
...
@@ -592,6 +720,10 @@ VOID xbytes.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xbytes.defined():
BOOL xbytes.defined()
...
...
@@ -599,6 +731,10 @@ BOOL xbytes.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xbytes.protect():
VOID xbytes.protect()
...
...
@@ -607,6 +743,10 @@ VOID xbytes.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xbytes.protected():
BOOL xbytes.protected()
...
...
@@ -614,6 +754,10 @@ BOOL xbytes.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.duration():
new xduration = topvar.duration([DURATION init])
...
...
@@ -631,6 +775,10 @@ DURATION xduration.get([DURATION fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is 0s.
Restricted to: ``client``.
.. _xduration.set():
VOID xduration.set(DURATION)
...
...
@@ -640,6 +788,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xduration.undefine():
VOID xduration.undefine()
...
...
@@ -647,6 +799,10 @@ VOID xduration.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xduration.defined():
BOOL xduration.defined()
...
...
@@ -654,6 +810,10 @@ BOOL xduration.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xduration.protect():
VOID xduration.protect()
...
...
@@ -662,6 +822,10 @@ VOID xduration.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xduration.protected():
BOOL xduration.protected()
...
...
@@ -669,6 +833,10 @@ BOOL xduration.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.header():
new xheader = topvar.header([HEADER init])
...
...
@@ -686,6 +854,10 @@ HEADER xheader.get([HEADER fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. Using .get() on an undefined value without a fallback triggers a VCL error.
Restricted to: ``client``.
.. _xheader.set():
VOID xheader.set(HEADER)
...
...
@@ -695,6 +867,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xheader.undefine():
VOID xheader.undefine()
...
...
@@ -702,6 +878,10 @@ VOID xheader.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xheader.defined():
BOOL xheader.defined()
...
...
@@ -709,6 +889,10 @@ BOOL xheader.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xheader.protect():
VOID xheader.protect()
...
...
@@ -717,6 +901,10 @@ VOID xheader.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xheader.protected():
BOOL xheader.protected()
...
...
@@ -724,6 +912,10 @@ BOOL xheader.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.int():
new xint = topvar.int([INT init])
...
...
@@ -741,6 +933,10 @@ INT xint.get([INT fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is 0.
Restricted to: ``client``.
.. _xint.set():
VOID xint.set(INT)
...
...
@@ -750,6 +946,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xint.undefine():
VOID xint.undefine()
...
...
@@ -757,6 +957,10 @@ VOID xint.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xint.defined():
BOOL xint.defined()
...
...
@@ -764,6 +968,10 @@ BOOL xint.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xint.protect():
VOID xint.protect()
...
...
@@ -772,6 +980,10 @@ VOID xint.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xint.protected():
BOOL xint.protected()
...
...
@@ -779,6 +991,10 @@ BOOL xint.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.ip():
new xip = topvar.ip([IP init])
...
...
@@ -796,6 +1012,10 @@ IP xip.get([IP fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is IPv4 0.0.0.0.
Restricted to: ``client``.
.. _xip.set():
VOID xip.set(IP)
...
...
@@ -805,6 +1025,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xip.undefine():
VOID xip.undefine()
...
...
@@ -812,6 +1036,10 @@ VOID xip.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xip.defined():
BOOL xip.defined()
...
...
@@ -819,6 +1047,10 @@ BOOL xip.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xip.protect():
VOID xip.protect()
...
...
@@ -827,6 +1059,10 @@ VOID xip.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xip.protected():
BOOL xip.protected()
...
...
@@ -834,6 +1070,10 @@ BOOL xip.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.probe():
new xprobe = topvar.probe([PROBE init])
...
...
@@ -851,6 +1091,10 @@ PROBE xprobe.get([PROBE fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is no backend.
Restricted to: ``client``.
.. _xprobe.set():
VOID xprobe.set(PROBE)
...
...
@@ -860,6 +1104,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xprobe.undefine():
VOID xprobe.undefine()
...
...
@@ -867,6 +1115,10 @@ VOID xprobe.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xprobe.defined():
BOOL xprobe.defined()
...
...
@@ -874,6 +1126,10 @@ BOOL xprobe.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xprobe.protect():
VOID xprobe.protect()
...
...
@@ -882,6 +1138,10 @@ VOID xprobe.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xprobe.protected():
BOOL xprobe.protected()
...
...
@@ -889,6 +1149,10 @@ BOOL xprobe.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.real():
new xreal = topvar.real([REAL init])
...
...
@@ -906,6 +1170,10 @@ REAL xreal.get([REAL fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is 0.0.
Restricted to: ``client``.
.. _xreal.set():
VOID xreal.set(REAL)
...
...
@@ -915,6 +1183,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xreal.undefine():
VOID xreal.undefine()
...
...
@@ -922,6 +1194,10 @@ VOID xreal.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xreal.defined():
BOOL xreal.defined()
...
...
@@ -929,6 +1205,10 @@ BOOL xreal.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xreal.protect():
VOID xreal.protect()
...
...
@@ -937,6 +1217,10 @@ VOID xreal.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xreal.protected():
BOOL xreal.protected()
...
...
@@ -944,6 +1228,10 @@ BOOL xreal.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.stevedore():
new xstevedore = topvar.stevedore([STEVEDORE init])
...
...
@@ -961,6 +1249,10 @@ STEVEDORE xstevedore.get([STEVEDORE fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is the default storage.
Restricted to: ``client``.
.. _xstevedore.set():
VOID xstevedore.set(STEVEDORE)
...
...
@@ -970,6 +1262,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xstevedore.undefine():
VOID xstevedore.undefine()
...
...
@@ -977,6 +1273,10 @@ VOID xstevedore.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xstevedore.defined():
BOOL xstevedore.defined()
...
...
@@ -984,6 +1284,10 @@ BOOL xstevedore.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xstevedore.protect():
VOID xstevedore.protect()
...
...
@@ -992,6 +1296,10 @@ VOID xstevedore.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xstevedore.protected():
BOOL xstevedore.protected()
...
...
@@ -999,6 +1307,10 @@ BOOL xstevedore.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.string():
new xstring = topvar.string([STRING init])
...
...
@@ -1016,6 +1328,10 @@ STRING xstring.get([STRING fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is the empty string.
Restricted to: ``client``.
.. _xstring.set():
VOID xstring.set(STRING)
...
...
@@ -1025,6 +1341,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xstring.undefine():
VOID xstring.undefine()
...
...
@@ -1032,6 +1352,10 @@ VOID xstring.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xstring.defined():
BOOL xstring.defined()
...
...
@@ -1039,6 +1363,10 @@ BOOL xstring.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xstring.protect():
VOID xstring.protect()
...
...
@@ -1047,6 +1375,10 @@ VOID xstring.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xstring.protected():
BOOL xstring.protected()
...
...
@@ -1054,6 +1386,10 @@ BOOL xstring.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
.. _topvar.time():
new xtime = topvar.time([TIME init])
...
...
@@ -1071,6 +1407,10 @@ TIME xtime.get([TIME fallback])
Return the value of the topvar or the `fallback` argument
if it is undefined. The default `fallback` is the epoch (1970/1/1 0:00:00 GMT).
Restricted to: ``client``.
.. _xtime.set():
VOID xtime.set(TIME)
...
...
@@ -1080,6 +1420,10 @@ Set the value of the topvar.
Triggers a vcl failure for protected variables.
Restricted to: ``client``.
.. _xtime.undefine():
VOID xtime.undefine()
...
...
@@ -1087,6 +1431,10 @@ VOID xtime.undefine()
Undefine the topvar.
Restricted to: ``client``.
.. _xtime.defined():
BOOL xtime.defined()
...
...
@@ -1094,6 +1442,10 @@ BOOL xtime.defined()
Return whether the topvar is defined.
Restricted to: ``client``.
.. _xtime.protect():
VOID xtime.protect()
...
...
@@ -1102,6 +1454,10 @@ VOID xtime.protect()
Protect the topvar, so any future .set() calls on it
trigger a vcl failure.
Restricted to: ``client``.
.. _xtime.protected():
BOOL xtime.protected()
...
...
@@ -1109,6 +1465,7 @@ BOOL xtime.protected()
Return whether the topvar is protected.
Restricted to: ``client``.
SEE ALSO
========
...
...
@@ -1120,26 +1477,28 @@ COPYRIGHT
::
Copyright 2018 UPLEX Nils Goroll Systemoptimierung
All rights reserved.
Copyright 2018-2022 UPLEX Nils Goroll Systemoptimierung
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
src/vmod_topvar.vcctpl
View file @
9c068644
...
...
@@ -62,18 +62,24 @@ will be initially undefined.\n \
$Method TYPE .get([TYPE fallback])\n \
Return the value of the topvar or the `fallback` argument\n \
if it is undefined. DEFDOC_ ## TYPE\n \
$Restrict client\n \
$Method VOID .set(TYPE)\n \
Set the value of the topvar.\n\n \
Triggers a vcl failure for protected variables.\n \
$Restrict client\n \
$Method VOID .undefine()\n \
Undefine the topvar.\n \
$Restrict client\n \
$Method BOOL .defined()\n \
Return whether the topvar is defined.\n \
$Restrict client\n \
$Method VOID .protect()\n \
Protect the topvar, so any future .set() calls on it\n \
trigger a vcl failure.\n \
$Restrict client\n \
$Method BOOL .protected()\n \
Return whether the topvar is protected.\n
Return whether the topvar is protected.\n \
$Restrict client\n
#include "tbl_types.h"
SEE ALSO
...
...
src/vtc/vmod_topvar.vtctpl
View file @
9c068644
...
...
@@ -37,9 +37,6 @@ varnish v1 \\
}
sub vcl_recv {
if (req.url ~ "^/backend/") {
return (pass);
}
#define VCC_TYPE(TYPE, type) \
if (req.http.what == #type) { \
set req.http.def1-x = x ## type %% .defined(); \
...
...
@@ -58,30 +55,6 @@ varnish v1 \\
return (hash);
}
sub vcl_backend_fetch {
if (bereq.url !~ "^/backend/") {
return (fetch);
} else
if (bereq.url ~ "/get$") {
set bereq.http.foo = xint.get();
} else
if (bereq.url ~ "/set$") {
xint.set(5);
} else
if (bereq.url ~ "/undefine$") {
xint.undefine();
} else
if (bereq.url ~ "/defined$") {
set bereq.http.foo = xint.defined();
} else
if (bereq.url ~ "/protect$") {
xint.protect();
} else
if (bereq.url ~ "/protected$") {
set bereq.http.foo = xint.protected();
}
}
sub vcl_deliver {
set resp.http.def1-x = req.http.def1-x;
set resp.http.def1-xd = req.http.def1-xd;
...
...
@@ -117,38 +90,33 @@ client c ## type {\n \
} -run
#include "../tbl_vtc.h"
client cget {
txreq -url "/backend/get"
rxresp
expect resp.status == 503
} -run
client cset {
txreq -url "/backend/set"
rxresp
expect resp.status == 503
} -run
client cundefine {
txreq -url "/backend/undefine"
rxresp
expect resp.status == 503
} -run
client cdefined {
txreq -url "/backend/defined"
rxresp
expect resp.status == 503
} -run
client cprotect {
txreq -url "/backend/protect"
rxresp
expect resp.status == 503
} -run
client cprotected {
txreq -url "/backend/protected"
rxresp
expect resp.status == 503
} -run
varnish v1 -errvcl {Not available in subroutine} {
import topvar;
backend none none;
sub vcl_init {
new xint = topvar.int();
}
sub vcl_backend_fetch {
if (bereq.url !~ "^/backend/") {
return (fetch);
} else
if (bereq.url ~ "/get$") {
set bereq.http.foo = xint.get();
} else
if (bereq.url ~ "/set$") {
xint.set(5);
} else
if (bereq.url ~ "/undefine$") {
xint.undefine();
} else
if (bereq.url ~ "/defined$") {
set bereq.http.foo = xint.defined();
} else
if (bereq.url ~ "/protect$") {
xint.protect();
} else
if (bereq.url ~ "/protected$") {
set bereq.http.foo = xint.protected();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment