Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
54df9be7
Commit
54df9be7
authored
Feb 19, 2013
by
Per Buer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add strings to syntax doc
parent
160b2e08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
vcl-syntax.rst
doc/sphinx/users-guide/vcl-syntax.rst
+46
-0
No files found.
doc/sphinx/users-guide/vcl-syntax.rst
View file @
54df9be7
...
...
@@ -13,11 +13,37 @@ Note that VCL doesn't contain any loops or jump statements.
Strings
~~~~~~~
Basic strings are enclosed in " ... ", and may not contain newlines.
Long strings are enclosed in {" ... "}. They may contain any character
including ", newline and other control characters except for the NUL
(0x00) character. If you really want NUL characters in a string there
is a VMOD that makes it possible to create such strings.
Access control lists (ACLs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
An ACL declaration creates and initializes a named access control list
which can later be used to match client addresses::
acl local {
"localhost"; // myself
"192.0.2.0"/24; // and everyone on the local network
! "192.0.2.23"; // except for the dialin router
}
If an ACL entry specifies a host name which Varnish is unable to
resolve, it will match any address it is compared to. Consequently,
if it is preceded by a negation mark, it will reject any address it is
compared to, which may not be what you intended. If the entry is
enclosed in parentheses, however, it will simply be ignored.
To match an IP address against an ACL, simply use the match operator::
if (client.ip ~ local) {
return (pipe);
}
Operators
~~~~~~~~~
...
...
@@ -43,3 +69,23 @@ down for, uhm, examples.
||
Logical *or*
Subroutines
~~~~~~~~~~~
A subroutine is used to group code for legibility or reusability:
::
sub pipe_if_local {
if (client.ip ~ local) {
return (pipe);
}
}
Subroutines in VCL do not take arguments, nor do they return values.
To call a subroutine, use the call keyword followed by the subroutine's name:
call pipe_if_local;
Varnish has quite a few built in subroutines that are called for each transaction as it flows through Varnish. See :ref:`vcl-built-in-subs`.
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