Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-selector
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-selector
Commits
92ef0fa9
Commit
92ef0fa9
authored
Jun 24, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the EXACT selector.
parent
99818aae
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
2 deletions
+94
-2
README.rst
README.rst
+1
-1
patricia.c
src/patricia.c
+5
-0
patricia.h
src/patricia.h
+1
-0
prefix.vtc
src/tests/prefix.vtc
+83
-0
vmod_selector.c
src/vmod_selector.c
+2
-0
vmod_selector.vcc
src/vmod_selector.vcc
+2
-1
No files found.
README.rst
View file @
92ef0fa9
...
...
@@ -161,7 +161,7 @@ INT xset.which(ENUM select)
::
INT xset.which(
ENUM {UNIQUE, FIRST, LAST, SHORTEST, LONGEST} select=UNIQUE
ENUM {UNIQUE,
EXACT,
FIRST, LAST, SHORTEST, LONGEST} select=UNIQUE
)
Returns ...
...
...
src/patricia.c
View file @
92ef0fa9
...
...
@@ -278,6 +278,10 @@ pt_search(const struct pt_y * const restrict y,
match
->
min
=
y
->
idx
;
if
(
y
->
idx
>
match
->
max
)
match
->
max
=
y
->
idx
;
if
(
*
c
==
'\0'
)
{
match
->
exact
=
y
->
idx
;
return
(
0
);
}
}
if
(
i
<
y
->
len
)
...
...
@@ -306,6 +310,7 @@ PT_Prefixes(const struct pt_y * const restrict root,
match
->
n
=
0
;
match
->
min
=
UINT_MAX
;
match
->
max
=
0
;
match
->
exact
=
UINT_MAX
;
return
(
pt_search
(
root
,
strings
,
(
unsigned
char
*
)
subject
,
match
));
}
...
...
src/patricia.h
View file @
92ef0fa9
...
...
@@ -40,6 +40,7 @@ struct match_data {
unsigned
*
indices
;
unsigned
limit
;
unsigned
n
;
unsigned
exact
;
unsigned
min
;
unsigned
max
;
};
...
...
src/tests/prefix.vtc
View file @
92ef0fa9
This diff is collapsed.
Click to expand it.
src/vmod_selector.c
View file @
92ef0fa9
...
...
@@ -387,6 +387,8 @@ select(VRT_CTX, const struct match_data * const restrict match,
}
return
match
->
indices
[
0
];
}
if
(
selects
==
vmod_enum_EXACT
)
return
match
->
exact
;
if
(
selects
==
vmod_enum_FIRST
)
return
match
->
min
;
if
(
selects
==
vmod_enum_LAST
)
...
...
src/vmod_selector.vcc
View file @
92ef0fa9
...
...
@@ -94,7 +94,8 @@ Example::
# ...
}
$Method INT .which(ENUM {UNIQUE, FIRST, LAST, SHORTEST, LONGEST} select=UNIQUE)
$Method INT .which(ENUM {UNIQUE, EXACT, FIRST, LAST, SHORTEST, LONGEST}
select=UNIQUE)
Returns ...
...
...
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