Commit 55ed27ac authored by Geoff Simmons's avatar Geoff Simmons

Backport for Varnish 5.1.x.

parent d868dc37
......@@ -30,7 +30,6 @@ import selector [from "path"] ;
new <obj> = selector.set([BOOL case_sensitive])
VOID <obj>.add(STRING [, STRING string] [, STRING regex]
[, BACKEND backend])
VOID <obj>.create_stats()
# Matching
BOOL <obj>.match(STRING)
......@@ -381,42 +380,6 @@ Example::
regex="^/quux/([^/]+)/");
}
.. _func_set.create_stats:
set.create_stats
----------------
::
VOID set.create_stats(PRIV_VCL)
Creates statistics counters for this object that are displayed by
tools such as ``varnishstat(1)``. See `STATISTICS`_ below for details.
It should be called in ``vcl_init`` after all strings have been added
to the set. No statistics are created for a set object if
``.create_stats()`` is not invoked.
Unlike the matching operations, the time needed for this method
increases as the number of strings in the set increases, since it
traverses the entire internal data structure. For large sets, the time
needed for a VCL load can become noticeably longer. If that is a
problem, consider using this method during development and testing,
and removing it for production deployments (since the stats values are
always the same for sets with the same strings).
``.create_stats()`` fails and invokes VCL failure if it is called in
any VCL subroutine besides ``vcl_init``.
Example::
sub vcl_init {
new myset = selector.set();
myset.add("foo");
myset.add("bar");
myset.add("baz");
myset.create_stats();
}
.. _func_set.match:
set.match
......@@ -793,53 +756,6 @@ Example::
std.log("Using VMOD selector version: " + selector.version());
STATISTICS
==========
When ``.create_stats()`` is invoked for a set object, statistics are
created that can be viewed with a tool like varnishstat(1).
*NOTE*: except for ``elements``, the stats refer to properties of a
set object's internal data structure, and hence depend on the internal
implementation. The implementation may be changed in any new version
of the VMOD, and hence the stats may change. If you install a new
version, check the new version of the present document to see if there
are new or different statistics.
The stats have the following naming schema::
SELECTOR.<vcl>.<object>.<stat>
... where ``<vcl>`` is the VCL instance name, ``<object>`` is the
object name, and ``<stat>`` is the statistic. So the ``elements`` stat
of the ``myset`` object in the VCL instance ``boot`` is named::
SELECTOR.boot.myset.elements
The VMOD currently provides the following statistics:
* ``elements``: the number of elements in the set (added via
``.add()``)
* ``nodes``: the total number of nodes in the internal data structure
* ``leaves``: the number of leaf nodes in the internal data structure.
There may be fewer leaf nodes than elements of the set, if the set
contains common prefixes.
* ``dmin``: the minimum depth of a terminating node in the internal
data structure; that is, a node at which a matching string may be
found (not necessarily a leaf node, if the set has common prefixes)
* ``dmax``: the maximum depth of a terminating node in the internal
data structure
* ``davg``: the average depth of a terminating node in the internal
data structure, rounded to the nearest integer
The values of the stats are constant; they do not change during the
lifetime of the VCL instance.
ERRORS
======
......@@ -867,7 +783,7 @@ a VCL subroutine:
REQUIREMENTS
============
The VMOD requires Varnish versions 5.2.x. See the VMOD source
The VMOD requires Varnish versions 5.1.x. See the VMOD source
repository for versions that are compatible with other Varnish
versions.
......@@ -916,12 +832,9 @@ SEE ALSO
* varnishd(1)
* vcl(7)
* varnishstat(1)
* varnish-cli(7)
* VMOD source repository: https://code.uplex.de/uplex-varnish/libvmod-selector
* `VMOD re2`_: https://code.uplex.de/uplex-varnish/libvmod-re2
COPYRIGHT
=========
......
......@@ -37,7 +37,7 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
m4_ifndef([VARNISH_PREREQ], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
VARNISH_PREREQ([5.2.0 5.2.1])
VARNISH_PREREQ([1.0.0], [5.1.3])
VARNISH_VMODS([selector])
VMOD_TESTS="$(cd $srcdir/src && echo tests/*.vtc)"
......@@ -91,24 +91,6 @@ if test "x$enable_debugging" != "xno"; then
[])
fi
# Varnish since 5.2.0 depends on AC_DEFINE(STATIC_ASSERT)
save_LIBS="${LIBS}"
LIBS=""
AC_CACHE_CHECK([for _Static_assert],
[ac_cv_static_assert],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
_Static_assert(1 == sizeof(char), "didn't work");
]],[[
]])],
[ac_cv_static_assert=yes],
[ac_cv_static_assert=no])
])
if test "$ac_cv_static_assert" = yes; then
AC_DEFINE([STATIC_ASSERT], [1], [Define if _Static_assert is availabel])
fi
LIBS="${save_LIBS}"
AC_CONFIG_FILES([
Makefile
src/Makefile
......
......@@ -12,15 +12,10 @@ libvmod_selector_la_SOURCES = \
nodist_libvmod_selector_la_SOURCES = \
vcc_if.c \
vcc_if.h \
VSC_selector.c \
VSC_selector.h
vcc_if.h
dist_man_MANS = vmod_selector.3
VSC_selector.c VSC_selector.h: selector.vsc
$(PYTHON) $(VSCTOOL) -ch $(srcdir)/selector.vsc
vmod_selector.c patricia.c: patricia.h
vmod_selector.lo: $(nodist_libvmod_selector_la_SOURCES)
......
......@@ -55,32 +55,8 @@ varnish v1 -vcl {
backend b { .host = "${bad_ip}"; }
sub vcl_init {
# 100 random choices from /usr/share/dict/words
# 25 random choices from /usr/share/dict/words
new s = selector.set(case_sensitive=false);
s.add("unsuccessful");
s.add("bogeyman's");
s.add("prelude");
s.add("Dniester");
s.add("brunet");
s.add("overseer");
s.add("choral's");
s.add("Tadzhikistan");
s.add("Becket");
s.add("rancor");
s.add("exterminating");
s.add("cancan's");
s.add("cockiness's");
s.add("approves");
s.add("Sallie's");
s.add("varlet's");
s.add("gestates");
s.add("ranter");
s.add("Lancelot's");
s.add("apathetically");
s.add("apprentice");
s.add("Cooper");
s.add("fifth's");
s.add("inquietude");
s.add("Gibraltar's");
s.add("Moss");
s.add("cowing");
......@@ -108,55 +84,6 @@ varnish v1 -vcl {
s.add("fission");
s.add("fixates");
s.add("grouper");
s.add("highborn");
s.add("damply");
s.add("smuggling");
s.add("droppings's");
s.add("emptiest");
s.add("phantasms");
s.add("archaeological");
s.add("vigilante's");
s.add("upturn's");
s.add("hussar's");
s.add("Buddhisms");
s.add("animators");
s.add("overused");
s.add("coccus");
s.add("porterhouse");
s.add("succulent");
s.add("truncates");
s.add("girt's");
s.add("mornings");
s.add("seats");
s.add("Hafiz's");
s.add("reprieve");
s.add("superintends");
s.add("defeatism's");
s.add("harps");
s.add("prospecting");
s.add("Delaney's");
s.add("vitriolic");
s.add("huddles");
s.add("fusible");
s.add("forking");
s.add("immersed");
s.add("chairlifts");
s.add("dillydallying");
s.add("unreasonableness's");
s.add("McLuhan");
s.add("anvils");
s.add("tapes");
s.add("yardsticks");
s.add("scribbler");
s.add("conceivably");
s.add("deprived");
s.add("scripting");
s.add("galley");
s.add("invasive");
s.add("percolates");
s.add("Millie");
s.add("mil's");
s.add("dethrones");
}
sub vcl_recv {
......@@ -173,153 +100,6 @@ varnish v1 -vcl {
client c1 {
# The same word list in reverse order, and randomly chosen
# case for each letter.
txreq -hdr "Word: dEThRONEs"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Mil's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: mILlIE"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: pERcOlATEs"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: inVASIvE"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: GALley"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: sCRIpTiNG"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: dEpRIveD"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: cONCeiVaBLy"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: SCribbLeR"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: YARdstIcKs"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: TaPes"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: AnVilS"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: mcLuhaN"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: unreAsONaBlEnEsS'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: DIlLydalLYIng"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ChAIRLIfts"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: imMeRSeD"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: FOrKINg"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: FusiblE"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: HUdDLES"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: vitriolic"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: dELANEy'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: prOspectINg"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: hArPS"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: DEFEatisM'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: sUperinteNDS"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: repRIEVE"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: hAfIz'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: SeATS"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: moRNIngS"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: giRT's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: TrUNcATES"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: SuCcULenT"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: PorTErHOuse"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: cOCcUS"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: oveRuSEd"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ANimAtORs"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: BuDDhiSms"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: huSSAr'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: uPTurN's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: VIgILaNte'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ArcHAeoLOgIcAl"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: PhAnTAsMs"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: EmPTiEsT"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: drOPPiNgS's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: SmUGgLiNg"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: DAmpLy"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: HIgHboRN"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: GROuPER"
rxresp
expect resp.http.Match == "true"
......@@ -401,80 +181,8 @@ client c1 {
txreq -hdr "Word: gibralTAR's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: iNQUIeTUDE"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: FiFth'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: CooPEr"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: aPpRENtice"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ApATheTIcAlLy"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: LAnCelot's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: RANTer"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: GeStaTEs"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: vARleT'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: sALliE'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ApPrOVES"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: cocKinesS'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: CanCaN's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: eXTERmInatiNG"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: rANCOR"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bEcKEt"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: tAdZhIkiStan"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ChoRAl's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: OVErseER"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: BrUNEt"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: dnieSTER"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: pRelUdE"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bogEymAn'S"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: unSuCCeSSFUl"
rxresp
expect resp.http.Match == "true"
# 100 random words generated with pwgen.
# 25 random words generated with pwgen.
txreq -hdr "Word: oozahdoo6U"
rxresp
expect resp.http.Match == "false"
......@@ -550,231 +258,6 @@ client c1 {
txreq -hdr "Word: Eenoquu4Pe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: iogh7ONge3"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eepholuth2"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: xa3aevee9B"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: queu9ex6Ae"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: OongeiN0fo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: uos1Iifi3O"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: phua8ohSee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: dahThi2vo4"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ahThung7fo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: opahH0Yaeg"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Jeev0dier9"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ub4dahShae"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: thaewe4Rah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: chei6jei4A"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eimeeW4yei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Echohf8Iwa"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eike7aez9V"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aemahdah0Z"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Iogh3ve9ah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: the1ciDio0"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ug4uobeiBe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: yiebaip6Fi"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Phuirilie4"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: TahtaeNg9e"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Shaixit5IT"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aik2QuooTh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ath3Ohbich"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: fei8Oogia7"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ohbee2aThe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Hei2chilai"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ahj4ohT2go"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ado3gaeChu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Aiphuaj3ui"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Cheiloow5o"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: oofaPhai8y"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: der0Ii0aev"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: oQu1wiu8ne"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Rei5oThoze"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: mujahJae5t"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Oht5la3omu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aequaifa7O"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ubee2iehio"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Thae8aiku1"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieTae3aiXa"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ATh9sei4li"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aghieh0Phe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: AeVe1jahfu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooChah1hee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: RaoKaeR1id"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: saihahh0Xa"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: puoLaesae2"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: euw1Laicij"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Fah7ak0Aeh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eeghohZo2e"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: noS8Uvee8a"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: kizai5Kong"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aiph9tai1U"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: sie8arieW4"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eaHohhoo1i"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: de6chooy0I"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ceimae7jae"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: fu7heeH0Oh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ido7cheiD8"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Aipao6vie5"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Zumoos2ait"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eiTe6oobiz"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Gufa9xa4ru"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: gan9Exiuzu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ogee6Veer6"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: etu4Igohra"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: saitai2Nei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ahDoobi7Ah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ICoe2aiqui"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: xiyieJeir6"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: lahya5Rae6"
rxresp
expect resp.http.Match == "false"
} -run
# Case-insensitive prefix matching
......
......@@ -56,7 +56,7 @@ varnish v1 -vcl {
backend b { .host = "${bad_ip}"; }
sub vcl_init {
# 100 random choices from /usr/share/dict/words
# 25 random choices from /usr/share/dict/words
new s = selector.set();
s.add("trustee's");
s.add("Marc");
......@@ -83,81 +83,6 @@ varnish v1 -vcl {
s.add("disgraced");
s.add("downswings");
s.add("pullback's");
s.add("Gregorio's");
s.add("spillways");
s.add("puller");
s.add("basilica's");
s.add("serviced");
s.add("insistently");
s.add("Frisian's");
s.add("question");
s.add("mien");
s.add("rockier");
s.add("indivisible");
s.add("megahertzes");
s.add("Oldfield's");
s.add("accusatory");
s.add("Mabel");
s.add("magnetize");
s.add("Philly");
s.add("Katheryn's");
s.add("policewoman's");
s.add("ashcan");
s.add("deviousness's");
s.add("suspends");
s.add("furnishings");
s.add("compiler's");
s.add("Claudio");
s.add("zestfully");
s.add("laughter's");
s.add("Manuel");
s.add("palatal's");
s.add("eminent");
s.add("strongboxes");
s.add("pinafores");
s.add("Glendale");
s.add("dethronement");
s.add("chlorinate");
s.add("Souths");
s.add("tilting");
s.add("trenched");
s.add("run");
s.add("initialized");
s.add("breakfast");
s.add("winning's");
s.add("mediates");
s.add("triads");
s.add("verdict");
s.add("Irish");
s.add("Jeremy");
s.add("handouts");
s.add("Billie's");
s.add("romanticist's");
s.add("descanting");
s.add("bidders");
s.add("play");
s.add("navigability's");
s.add("leapfrogging");
s.add("Libby");
s.add("smelter's");
s.add("hermit's");
s.add("Tabatha's");
s.add("churlish");
s.add("spuriousness's");
s.add("Salish's");
s.add("Curry");
s.add("hula");
s.add("ruse's");
s.add("bureaucratic");
s.add("Moseley");
s.add("confluence");
s.add("inseams");
s.add("producers");
s.add("cozier");
s.add("augur's");
s.add("electrode's");
s.add("disposition");
s.add("Rena's");
}
sub vcl_recv {
......@@ -173,308 +98,83 @@ varnish v1 -vcl {
client c1 {
# The same word list permuted with shuf.
txreq -hdr "Word: Gregorio's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Moseley"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: tilting"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Marc"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: zestfully"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: handouts"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Libby"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: producers"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: deviousness's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: rockier"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: disgraced"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Donny's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Denny"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Salish's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Irish"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: barnyards"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: initialized"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: winning's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bureaucratic"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: play"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Jeremy"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: laughter's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: indivisible"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Billie's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: churlish"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: electrode's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: trenched"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Mabel"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Lanai's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: basilica's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bidders"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: pinafores"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: eminent"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: mien"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: compiler's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: magnetize"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: inseams"
txreq -hdr "Word: disgraced"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: chlorinate"
txreq -hdr "Word: Blythe"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: strongboxes"
txreq -hdr "Word: trustee's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: redefinition"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: cozier"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: confluence"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: paperweight"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: run"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: backed"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Glendale"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: serviced"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Philly"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Souths"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: brutishly"
txreq -hdr "Word: Denny"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: tastier"
txreq -hdr "Word: barnyards"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Oldfield's"
txreq -hdr "Word: faze"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: rain"
txreq -hdr "Word: unstrung"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: kicker's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: triads"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Kazan's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: leapfrogging"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: spuriousness's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: trustee's"
txreq -hdr "Word: tastier"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Schulz"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Frisian's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: dethronement"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: suspends"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ruse's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: accusatory"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: remover's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: question"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Claudio"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: descanting"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: breakfast"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Tabatha's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: hermit's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: smelter's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: unstrung"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Rena's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: banality"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: palatal's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Katheryn's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: disposition"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Manuel"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: mediates"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: pullback's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: megahertzes"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: insistently"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: navigability's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: policewoman's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: augur's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: faze"
txreq -hdr "Word: Lanai's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: verdict"
txreq -hdr "Word: bastions"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Curry"
txreq -hdr "Word: rain"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: romanticist's"
txreq -hdr "Word: downswings"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: fanfares"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: furnishings"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Blythe"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: puller"
txreq -hdr "Word: pullback's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bastions"
txreq -hdr "Word: banality"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: hula"
txreq -hdr "Word: brutishly"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: downswings"
txreq -hdr "Word: Kazan's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ashcan"
txreq -hdr "Word: paperweight"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: spillways"
txreq -hdr "Word: backed"
rxresp
expect resp.http.Match == "true"
# 100 random words generated with pwgen.
# 25 random words generated with pwgen.
txreq -hdr "Word: eCohz5que"
rxresp
expect resp.http.Match == "false"
......@@ -550,231 +250,6 @@ client c1 {
txreq -hdr "Word: eePh2oo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: UNahbu2"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieZ7lo7"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eiPhohjah0H"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: xeeQu2eer"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: zei9aeF"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: shei3B"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Oi3Waigo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: toyie7Shoo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Soo8oe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: shie7Rah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ahg1aew"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieGhe3ou6eew"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ekoak6"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: gahmoo8Quahp"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ogiy4B"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ohra8Io"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: zohj9lo3luP"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Doo4beedo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ughae6Chan"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: go1Shie0chee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Cako5zoh8Ie"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: jo9OV8heik"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: oCho0L"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: jieG2ee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Exoh8ye"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Da0neequu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Aijoh9a"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eicheeth8ine"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Om9oosh1"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: zee3Doof0N"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieZ0iexa"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eijeevai0"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ohgi0ieS"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Osei5ogaigu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ohSoo4eik9ta"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ciem3xaeB"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: HeiRe0ohFooh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: faipaik3U"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: tohS0E"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: phie8I"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ooxe3sh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Pei4Iepoo5ye"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eipaphii3ahv"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Aenah0ahvo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Vequo1r"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Oob8zoh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aiV6koh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Vaeheidai0ei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Phie8que"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: uek8Di"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: tohj2Qu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ivohvoo9c"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: looqu9Pi"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ouwu2ahsh1r"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: yeeD4Ixe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: nephuShoow1v"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooR1aiNg"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieS8xa"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ai5aeBaipho"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ifes5ahquoo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: EiS1ee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: er1Ousaeja"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: yie5Oobu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eimou7ooGei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ioWahv0U"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooPh3ba"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ang1Ra5Ahqua"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eang2ooMah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooPh5aho7aut"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: uo4oochu3eeN"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ohng5ei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: xuo0ShooP"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: OhGae1"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aesiad6Be"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: uJaiZ6ieko"
rxresp
expect resp.http.Match == "false"
} -run
varnish v1 -errvcl {vmod selector failure: t.add(): "foo" added more than once} {
......
......@@ -1250,201 +1250,6 @@ client c1 {
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: Eej5xeNies"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: ta2UBaem2k"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: caepez0AiT"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: Buc0ieCohm"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: wie1EHee1o"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: ha6Olo8foo"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: Veengae7Wo"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: ui7OhY8oro"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: aiqui8eTho"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: Wiequeeve1"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: ohMeim7sai"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: Equie2ohri"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: ga5Aepikie"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: Jaibie6che"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
txreq -hdr "Word: reide9aeGh"
rxresp
expect resp.status == 200
expect resp.http.Match == "false"
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Which-Unique == resp.http.Which
expect resp.http.Which-Exact == "0"
expect resp.http.Which-First == "0"
expect resp.http.Which-Last == "0"
expect resp.http.Which-Shortest == "0"
expect resp.http.Which-Longest == "0"
} -run
varnish v1 -vcl {
......
# looks like -*- vcl -*-
varnishtest ".create_stats() method"
varnish v1 -vcl {
import ${vmod_selector};
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new s = selector.set();
s.add("foo");
s.add("bar");
s.add("baz");
s.add("quux");
s.create_stats();
}
} -start
varnish v1 -vsc SELECTOR.*
varnish v1 -expect SELECTOR.vcl1.s.elements == 4
varnish v1 -expect SELECTOR.vcl1.s.nodes > 0
varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4
varnish v1 -expect SELECTOR.vcl1.s.dmin > 0
varnish v1 -expect SELECTOR.vcl1.s.dmax > 0
varnish v1 -expect SELECTOR.vcl1.s.davg > 0
varnish v1 -vcl {
import ${vmod_selector};
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new p = selector.set();
p.add("foo");
p.add("foobar");
p.add("foobarbaz");
p.add("foobarbazquux");
p.create_stats();
# No .create_stats() call.
new n = selector.set();
n.add("foo");
n.add("bar");
n.add("baz");
n.add("quux");
# Calling .create_stats() on an empty set is
# pointless, but not an error.
new e = selector.set();
e.create_stats();
}
}
# Stats for vc1.s and vcl2.p appear, but not for vcl2.n.
varnish v1 -vsc SELECTOR.*
varnish v1 -expect SELECTOR.vcl2.p.elements == 4
varnish v1 -expect SELECTOR.vcl2.p.nodes > 0
varnish v1 -expect SELECTOR.vcl2.p.leaves <= 4
varnish v1 -expect SELECTOR.vcl2.p.dmin > 0
varnish v1 -expect SELECTOR.vcl2.p.dmax > 0
varnish v1 -expect SELECTOR.vcl2.p.davg > 0
varnish v1 -expect SELECTOR.vcl2.e.elements == 0
varnish v1 -expect SELECTOR.vcl2.e.nodes == 0
varnish v1 -expect SELECTOR.vcl2.e.leaves == 0
varnish v1 -expect SELECTOR.vcl2.e.dmin == 0
varnish v1 -expect SELECTOR.vcl2.e.dmax == 0
varnish v1 -expect SELECTOR.vcl2.e.davg == 0
# cold/warm states do *not* affect stats visibility in Varnish < 6.0.0
varnish v1 -cliok "vcl.state vcl1 cold"
varnish v1 -vsc SELECTOR.*
varnish v1 -cliok "vcl.state vcl1 warm"
varnish v1 -vsc SELECTOR.*
varnish v1 -expect SELECTOR.vcl1.s.elements == 4
varnish v1 -expect SELECTOR.vcl1.s.nodes > 0
varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4
varnish v1 -expect SELECTOR.vcl1.s.dmin > 0
varnish v1 -expect SELECTOR.vcl1.s.dmax > 0
varnish v1 -expect SELECTOR.vcl1.s.davg > 0
# The same 100 words from /usr/share/dict/words as in match.vtc
varnish v1 -vcl {
import ${vmod_selector};
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new words = selector.set();
words.add("trustee's");
words.add("Marc");
words.add("remover's");
words.add("brutishly");
words.add("Blythe");
words.add("tastier");
words.add("backed");
words.add("rain");
words.add("banality");
words.add("unstrung");
words.add("barnyards");
words.add("paperweight");
words.add("Kazan's");
words.add("fanfares");
words.add("Donny's");
words.add("faze");
words.add("redefinition");
words.add("Schulz");
words.add("Lanai's");
words.add("bastions");
words.add("kicker's");
words.add("Denny");
words.add("disgraced");
words.add("downswings");
words.add("pullback's");
words.add("Gregorio's");
words.add("spillways");
words.add("puller");
words.add("basilica's");
words.add("serviced");
words.add("insistently");
words.add("Frisian's");
words.add("question");
words.add("mien");
words.add("rockier");
words.add("indivisible");
words.add("megahertzes");
words.add("Oldfield's");
words.add("accusatory");
words.add("Mabel");
words.add("magnetize");
words.add("Philly");
words.add("Katheryn's");
words.add("policewoman's");
words.add("ashcan");
words.add("deviousness's");
words.add("suspends");
words.add("furnishings");
words.add("compiler's");
words.add("Claudio");
words.add("zestfully");
words.add("laughter's");
words.add("Manuel");
words.add("palatal's");
words.add("eminent");
words.add("strongboxes");
words.add("pinafores");
words.add("Glendale");
words.add("dethronement");
words.add("chlorinate");
words.add("Souths");
words.add("tilting");
words.add("trenched");
words.add("run");
words.add("initialized");
words.add("breakfast");
words.add("winning's");
words.add("mediates");
words.add("triads");
words.add("verdict");
words.add("Irish");
words.add("Jeremy");
words.add("handouts");
words.add("Billie's");
words.add("romanticist's");
words.add("descanting");
words.add("bidders");
words.add("play");
words.add("navigability's");
words.add("leapfrogging");
words.add("Libby");
words.add("smelter's");
words.add("hermit's");
words.add("Tabatha's");
words.add("churlish");
words.add("spuriousness's");
words.add("Salish's");
words.add("Curry");
words.add("hula");
words.add("ruse's");
words.add("bureaucratic");
words.add("Moseley");
words.add("confluence");
words.add("inseams");
words.add("producers");
words.add("cozier");
words.add("augur's");
words.add("electrode's");
words.add("disposition");
words.add("Rena's");
words.create_stats();
}
}
varnish v1 -expect SELECTOR.vcl3.words.elements == 100
varnish v1 -expect SELECTOR.vcl3.words.nodes > 0
varnish v1 -expect SELECTOR.vcl3.words.leaves <= 100
varnish v1 -expect SELECTOR.vcl3.words.dmin > 0
varnish v1 -expect SELECTOR.vcl3.words.dmax > 0
varnish v1 -expect SELECTOR.vcl3.words.davg > 0
varnish v1 -cliok "vcl.state vcl1 cold"
varnish v1 -cli "vcl.discard vcl1"
# No stats for vcl1 appear after discard.
varnish v1 -vsc SELECTOR.vc1.*
# The same for vcl2 after discard.
varnish v1 -cli "vcl.discard vcl2"
varnish v1 -vsc SELECTOR.vc2.*
varnish v1 -vcl {
import ${vmod_selector};
backend b { .host = "${bad_ip}"; }
sub vcl_init {
# No .create_stats() call.
new n = selector.set();
n.add("foo");
n.add("bar");
n.add("baz");
n.add("quux");
}
sub vcl_recv {
n.create_stats();
return(synth(200));
}
}
client c1 {
txreq
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
} -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error {^vmod selector failure: n\.create_stats\(\) may only be called in vcl_init$}
expect * = End
} -run
......@@ -44,7 +44,6 @@
#include "vcc_if.h"
#include "patricia.h"
#include "VSC_selector.h"
#define VFAIL(ctx, fmt, ...) \
VRT_fail((ctx), "vmod selector failure: " fmt, __VA_ARGS__)
......@@ -90,58 +89,17 @@ struct vmod_selector_set {
VCL_BOOL case_sensitive;
};
struct vsc_entry {
unsigned magic;
#define VMOD_SELECTOR_VSC_MAGIC 0x4b99b64a
VSLIST_ENTRY(vsc_entry) list;
struct VSC_selector *vsc;
};
VSLIST_HEAD(vsc_head, vsc_entry);
/* Event function */
int
event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
{
struct vsc_head *vsc_head;
struct vsc_entry *vsc_entry;
ASSERT_CLI();
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(priv);
(void) ctx;
(void) priv;
if (priv->priv == NULL) {
vsc_head = malloc(sizeof(*vsc_head));
AN(vsc_head);
priv->priv = vsc_head;
VSLIST_INIT(vsc_head);
}
else
vsc_head = priv->priv;
switch(e) {
case VCL_EVENT_LOAD:
if (!PT_Inited())
PT_Init();
break;
case VCL_EVENT_DISCARD:
while (!VSLIST_EMPTY(vsc_head)) {
vsc_entry = VSLIST_FIRST(vsc_head);
CHECK_OBJ_NOTNULL(vsc_entry, VMOD_SELECTOR_VSC_MAGIC);
VSC_selector_Destroy(&vsc_entry->vsc);
VSLIST_REMOVE_HEAD(vsc_head, list);
FREE_OBJ(vsc_entry);
}
free(vsc_head);
break;
case VCL_EVENT_WARM:
case VCL_EVENT_COLD:
break;
default:
WRONG("illegal event enum");
}
return 0;
if (e == VCL_EVENT_LOAD && !PT_Inited())
PT_Init();
return (0);
}
/* Object regex */
......@@ -463,7 +421,7 @@ vmod_set_hasprefix(VRT_CTX, struct vmod_selector_set *set, VCL_STRING subject)
static struct match_data *
get_existing_match_data(VRT_CTX,
const struct vmod_selector_set * const restrict set,
struct vmod_selector_set * const restrict set,
const char * const restrict method)
{
struct vmod_priv *task;
......@@ -577,7 +535,7 @@ vmod_set_which(VRT_CTX, struct vmod_selector_set *set, VCL_ENUM selects)
}
static unsigned
get_idx(VRT_CTX, VCL_INT n, const struct vmod_selector_set * const restrict set,
get_idx(VRT_CTX, VCL_INT n, struct vmod_selector_set * const restrict set,
const char * const restrict method, VCL_ENUM const restrict selects)
{
struct match_data *match;
......@@ -669,9 +627,8 @@ vmod_set_string(VRT_CTX, struct vmod_selector_set * set, VCL_INT n,
}
static vre_t *
get_re(VRT_CTX, const struct vmod_selector_set * const restrict set,
VCL_INT n, VCL_ENUM const restrict selects,
const char * const restrict method)
get_re(VRT_CTX, struct vmod_selector_set * const restrict set, VCL_INT n,
VCL_ENUM const restrict selects, const char * const restrict method)
{
unsigned idx;
vre_t *re;
......@@ -732,57 +689,6 @@ vmod_set_debug(VRT_CTX, struct vmod_selector_set *set)
return output;
}
VCL_VOID
vmod_set_create_stats(VRT_CTX, struct vmod_selector_set *set,
struct vmod_priv *priv)
{
struct pt_stats stats = { .magic = PT_STATS_MAGIC };
struct VSC_selector *vsc;
struct vsc_head *vsc_head;
struct vsc_entry *vsc_entry;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(set, VMOD_SELECTOR_SET_MAGIC);
if ((ctx->method & VCL_MET_INIT) == 0) {
VFAIL(ctx, "%s.create_stats() may only be called in vcl_init",
set->vcl_name);
return;
}
AN(priv);
AN(priv->priv);
vsc_head = priv->priv;
if (set->nmembers == 0)
memset(&stats, 0, sizeof(stats));
else {
char **members = set->members;
if (!set->case_sensitive)
members = set->lomembers;
AN(members);
PT_Stats(set->origo, members, &stats);
assert(stats.terms == set->nmembers);
assert(stats.leaves <= stats.terms);
assert(stats.terms <= stats.nodes);
assert(stats.dmin <= stats.dmax);
assert(stats.dmin <= stats.davg);
assert(stats.davg <= stats.dmax);
}
vsc = VSC_selector_New("%s.%s", VCL_Name(ctx->vcl), set->vcl_name);
vsc->elements = set->nmembers;
vsc->nodes = stats.nodes;
vsc->leaves = stats.leaves;
vsc->dmin = stats.dmin;
vsc->dmax = stats.dmax;
vsc->davg = (uint64_t)(stats.davg + 0.5);
ALLOC_OBJ(vsc_entry, VMOD_SELECTOR_VSC_MAGIC);
AN(vsc_entry);
vsc_entry->vsc = vsc;
VSLIST_INSERT_HEAD(vsc_head, vsc_entry, list);
}
VCL_STRING
vmod_version(VRT_CTX)
{
......
......@@ -17,7 +17,6 @@ $Module selector 3 Varnish Module for matching strings associated with backends,
new <obj> = selector.set([BOOL case_sensitive])
VOID <obj>.add(STRING [, STRING string] [, STRING regex]
[, BACKEND backend])
VOID <obj>.create_stats()
# Matching
BOOL <obj>.match(STRING)
......@@ -348,35 +347,6 @@ Example::
regex="^/quux/([^/]+)/");
}
$Method VOID .create_stats(PRIV_VCL)
Creates statistics counters for this object that are displayed by
tools such as ``varnishstat(1)``. See `STATISTICS`_ below for details.
It should be called in ``vcl_init`` after all strings have been added
to the set. No statistics are created for a set object if
``.create_stats()`` is not invoked.
Unlike the matching operations, the time needed for this method
increases as the number of strings in the set increases, since it
traverses the entire internal data structure. For large sets, the time
needed for a VCL load can become noticeably longer. If that is a
problem, consider using this method during development and testing,
and removing it for production deployments (since the stats values are
always the same for sets with the same strings).
``.create_stats()`` fails and invokes VCL failure if it is called in
any VCL subroutine besides ``vcl_init``.
Example::
sub vcl_init {
new myset = selector.set();
myset.add("foo");
myset.add("bar");
myset.add("baz");
myset.create_stats();
}
$Method BOOL .match(STRING)
Returns ``true`` if the given STRING exactly matches one of the
......@@ -680,53 +650,6 @@ Example::
std.log("Using VMOD selector version: " + selector.version());
STATISTICS
==========
When ``.create_stats()`` is invoked for a set object, statistics are
created that can be viewed with a tool like varnishstat(1).
*NOTE*: except for ``elements``, the stats refer to properties of a
set object's internal data structure, and hence depend on the internal
implementation. The implementation may be changed in any new version
of the VMOD, and hence the stats may change. If you install a new
version, check the new version of the present document to see if there
are new or different statistics.
The stats have the following naming schema::
SELECTOR.<vcl>.<object>.<stat>
... where ``<vcl>`` is the VCL instance name, ``<object>`` is the
object name, and ``<stat>`` is the statistic. So the ``elements`` stat
of the ``myset`` object in the VCL instance ``boot`` is named::
SELECTOR.boot.myset.elements
The VMOD currently provides the following statistics:
* ``elements``: the number of elements in the set (added via
``.add()``)
* ``nodes``: the total number of nodes in the internal data structure
* ``leaves``: the number of leaf nodes in the internal data structure.
There may be fewer leaf nodes than elements of the set, if the set
contains common prefixes.
* ``dmin``: the minimum depth of a terminating node in the internal
data structure; that is, a node at which a matching string may be
found (not necessarily a leaf node, if the set has common prefixes)
* ``dmax``: the maximum depth of a terminating node in the internal
data structure
* ``davg``: the average depth of a terminating node in the internal
data structure, rounded to the nearest integer
The values of the stats are constant; they do not change during the
lifetime of the VCL instance.
ERRORS
======
......@@ -754,7 +677,7 @@ a VCL subroutine:
REQUIREMENTS
============
The VMOD requires Varnish versions 5.2.x. See the VMOD source
The VMOD requires Varnish versions 5.1.x. See the VMOD source
repository for versions that are compatible with other Varnish
versions.
......@@ -803,11 +726,7 @@ SEE ALSO
* varnishd(1)
* vcl(7)
* varnishstat(1)
* varnish-cli(7)
* VMOD source repository: https://code.uplex.de/uplex-varnish/libvmod-selector
* `VMOD re2`_: https://code.uplex.de/uplex-varnish/libvmod-re2
$Event event
$ABI vrt
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment