Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re
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
libvmod-re
Commits
0070ecf8
Commit
0070ecf8
authored
Sep 28, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expanded the README section LIMITATIONS
parent
f5ebe9e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
12 deletions
+41
-12
README.rst
README.rst
+41
-12
No files found.
README.rst
View file @
0070ecf8
...
...
@@ -2,13 +2,13 @@
vmod_re
=======
-------------------------------------------------------------------
Varnish Module for Regular Expression Matching with
Backref
Capture
-------------------------------------------------------------------
-------------------------------------------------------------------
------
Varnish Module for Regular Expression Matching with
Subexpression
Capture
-------------------------------------------------------------------
------
:Manual section: 3
:Author: Geoffrey Simmons
:Date: 2013-09-
13
:Date: 2013-09-
28
:Version: 0.1
SYNOPSIS
...
...
@@ -44,7 +44,7 @@ Example VCL::
sub vcl_fetch {
if (re.match_dyn(req.http.Cookie, beresp.http.X-Regex)) {
set resp.http.Foo = re.backref(
1
, "");
set resp.http.Foo = re.backref(
2
, "");
}
}
...
...
@@ -94,10 +94,10 @@ Returns
String
Description
Extracts the `nth` subexpression of the most recent successful
call to ``re.match
()
`` or ``re.match_dyn`` in the same VCL
call to ``re.match`` or ``re.match_dyn`` in the same VCL
subroutine in the current session, or a fallback string in
case the extraction fails. Backref 0 indicates the entire
matched string. Thus this function behaves like the ``\
\
n``
matched string. Thus this function behaves like the ``\n``
symbols in ``regsub`` and ``regsuball``, and the ``$1``,
``$2`` ... variables in Perl.
...
...
@@ -105,14 +105,14 @@ Description
for any call to ``re.backref``.
The VCL infix operators ``~`` and ``!~`` do not affect this
function, nor do ``regsub`` or ``regsuball``.
function, nor do
the functions
``regsub`` or ``regsuball``.
``re.backref`` can extract up to 10 subexpressions, in
addition to t
o t
he full expression indicated by backref 0.
addition to the full expression indicated by backref 0.
If ``re.backref`` is called without any prior call to
``re.match`` or ``re.match_dyn`` in the same VCL subroutine
,
then the result is undefined.
``re.match`` or ``re.match_dyn`` in the same VCL subroutine
call,
then the result is undefined.
Example
``set beresp.ttl = std.duration(re.backref(1, "120"), 120s);``
...
...
@@ -175,9 +175,38 @@ invalid expressions. If an expression is invalid, then an error
message is emitted to Varnish's shared memory log using the
``VCL_error`` tag, and the match always fails.
To maintain per-session state about the most recent regex matches, the
vmod creates a table at initialization sized to the maximum file
descriptor number (``ulimit -n``) defined for Varnish's process owner
(since Varnish 3 uses file descriptor numbers as session
IDs). Moreover, it fails an assertion (aborting Varnish) if the
process owner is able to increase its own max file descriptor.
The vmod only allocates the state data for session IDs that are
actually used; nevertheless, this may lead to an unecessarily large
memory footprint if the ``ulimit -n`` value for the Varnish user is
excessively high.
If you cannot configure the Varnish user so that it is unable to
increase its own max file descriptor, you can disable the assertion
that fails in that case by compiling the vmod with
``-DDISABLE_MAXFD_TEST``. But be warned that Varnish running the vmod
will crash if it ever uses a file descriptor for a session ID that is
larger than the value of ``ulimit -n`` at vmod initialization.
For best results, configure the Varnish user so that its max file
descriptor is just a bit larger than ``thread_pools *
thread_pool_max``, and cannot be increased by the user.
The vmod allocates space for captured subexpressions from session
workspaces. For typical usage, the default workspace size is almost
certainly enough; but if you are capturing many, long subexpressions
in each session, you might need to increase the Varnish parameter
``sess_workspace``.
Regular expression matching is subject to the same limitations that
hold for standard regexen in VCL, for example as set by the runtime
parameters `
pcre_match_limit` and `pcre_match_limit_recursion
`.
parameters `
`pcre_match_limit`` and ``pcre_match_limit_recursion`
`.
SEE ALSO
...
...
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