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
8f7a8518
Commit
8f7a8518
authored
May 11, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't copy the subject string if it's already in workspace.
parent
b0c33f72
Pipeline
#203
skipped
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
40 deletions
+30
-40
README.rst
README.rst
+12
-17
vmod_re.c
src/vmod_re.c
+6
-6
vmod_re.vcc
src/vmod_re.vcc
+12
-17
No files found.
README.rst
View file @
8f7a8518
...
...
@@ -329,27 +329,22 @@ Version 2.0: compatible with Varnish 5.1
LIMITATIONS
===========
Regular expressions passed into the constructor and into ``match_dyn``
are compiled at run-time, so there are no errors at VCL compile-time
for invalid expressions. If an expression is invalid, then a
``VCL_error`` message is emitted to the Varnish log, matches always
fail, and errors in the constructor can be inspected with ``failed``
and ``error``.
The VMOD allocates memory for captured subexpressions from Varnish
workspaces, whose sizes are determined by the runtime parameters
``workspace_backend``, for calls within the ``vcl_backend_*``
subroutines, and ``workspace_client``, for the other VCL subs. The
VMOD copies the string to be matched into the workspace, along with
some overhead. For typical usage, the default workspace sizes are
probably enough; but if you are matching against many, long strings in
each client or backend context, you might need to increase the Varnish
parameters for workspace sizes. If the VMOD cannot allocate enough
workspace, then a ``VCL_error`` message is emitted, and the match
methods as well as ``backref`` will fail. (If you're just using the
regexen for matching and not to capture backrefs, then you might as
well just use the standard VCL operators ``~`` and ``!~``, and save
the workspace.)
VMOD copies the string to be matched into the workspace, if it's not
already in the workspace, and also uses workspace to save data about
backreferences.
For typical usage, the default workspace sizes are probably enough;
but if you are matching against many, long strings in each client or
backend context, you might need to increase the Varnish parameters for
workspace sizes. If the VMOD cannot allocate enough workspace, then a
``VCL_error`` message is emitted, and the match methods as well as
``backref`` will fail. (If you're just using the regexen for matching
and not to capture backrefs, then you might as well just use the
standard VCL operators ``~`` and ``!~``, and save the workspace.)
``backref`` can extract up to 10 subexpressions, in addition to the
full expression indicated by backref 0. If a ``match`` or
...
...
src/vmod_re.c
View file @
8f7a8518
...
...
@@ -136,8 +136,7 @@ match(VRT_CTX, vre_t *vre, VCL_STRING subject, struct vmod_priv *task)
{
ov_t
*
ov
;
int
s
,
nov
[
MAX_OV
];
uintptr_t
snap
;
size_t
cp
;
size_t
cp
,
len
;
AN
(
vre
);
if
(
subject
==
NULL
)
...
...
@@ -173,10 +172,11 @@ match(VRT_CTX, vre_t *vre, VCL_STRING subject, struct vmod_priv *task)
}
task
->
len
=
sizeof
(
*
ov
);
snap
=
WS_Snapshot
(
ctx
->
ws
);
ov
->
subject
=
WS_Copy
(
ctx
->
ws
,
(
const
void
*
)
subject
,
-
1
);
if
(
ov
->
subject
==
NULL
)
{
WS_Reset
(
ctx
->
ws
,
snap
);
len
=
strlen
(
subject
);
if
(
WS_Inside
(
ctx
->
ws
,
subject
,
subject
+
len
))
ov
->
subject
=
subject
;
else
if
((
ov
->
subject
=
WS_Copy
(
ctx
->
ws
,
(
const
void
*
)
subject
,
len
))
==
NULL
)
{
VSLb
(
ctx
->
vsl
,
SLT_VCL_Error
,
"vmod re: insufficient workspace"
);
return
0
;
...
...
src/vmod_re.vcc
View file @
8f7a8518
...
...
@@ -265,27 +265,22 @@ Version 2.0: compatible with Varnish 5.1
LIMITATIONS
===========
Regular expressions passed into the constructor and into ``match_dyn``
are compiled at run-time, so there are no errors at VCL compile-time
for invalid expressions. If an expression is invalid, then a
``VCL_error`` message is emitted to the Varnish log, matches always
fail, and errors in the constructor can be inspected with ``failed``
and ``error``.
The VMOD allocates memory for captured subexpressions from Varnish
workspaces, whose sizes are determined by the runtime parameters
``workspace_backend``, for calls within the ``vcl_backend_*``
subroutines, and ``workspace_client``, for the other VCL subs. The
VMOD copies the string to be matched into the workspace, along with
some overhead. For typical usage, the default workspace sizes are
probably enough; but if you are matching against many, long strings in
each client or backend context, you might need to increase the Varnish
parameters for workspace sizes. If the VMOD cannot allocate enough
workspace, then a ``VCL_error`` message is emitted, and the match
methods as well as ``backref`` will fail. (If you're just using the
regexen for matching and not to capture backrefs, then you might as
well just use the standard VCL operators ``~`` and ``!~``, and save
the workspace.)
VMOD copies the string to be matched into the workspace, if it's not
already in the workspace, and also uses workspace to save data about
backreferences.
For typical usage, the default workspace sizes are probably enough;
but if you are matching against many, long strings in each client or
backend context, you might need to increase the Varnish parameters for
workspace sizes. If the VMOD cannot allocate enough workspace, then a
``VCL_error`` message is emitted, and the match methods as well as
``backref`` will fail. (If you're just using the regexen for matching
and not to capture backrefs, then you might as well just use the
standard VCL operators ``~`` and ``!~``, and save the workspace.)
``backref`` can extract up to 10 subexpressions, in addition to the
full expression indicated by backref 0. If a ``match`` or
...
...
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