summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2014-11-01 12:10:23 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2014-11-01 12:10:23 (GMT)
commitdacdfd20c9e59e088bfb23c2852b566acc6ad06f (patch) (unidiff)
tree9c8acf2e253afd9593d5f6fccd560f7173485d48
parent4d452a770122daf33fdbe0a549e2804b6f2db086 (diff)
downloadvmod-tbf-dacdfd20c9e59e088bfb23c2852b566acc6ad06f.tar.gz
vmod-tbf-dacdfd20c9e59e088bfb23c2852b566acc6ad06f.tar.bz2
Support for VCL 4.0
* NEWS: Update. * configure.ac: Version 1.0.90 Detect Varnish version, set up the C defines and automake conditionals to indicate it. * src/.gitignore: Update. * src/Makefile.am: Don't distribute vcc_if.c and vcc_if.h, build them for the current Varnish version. * src/tbf.h: New file. * src/getla.c: Include tbf.h, rewrite to compile with both 3.0 and 4.0 * src/sleep.c: Likewise. * src/tbf.c: Likewise. * src/time.c: Likewise. * src/vmod_tbf.vcc: Rewrite using v4.0 format. * tests/.gitignore: New file. * tests/Makefile.am: Build test00.vtc and test02.vtc * tests/test00.vtc: Rename to tests/test00.vti, add conditional compilation directives. * tests/test02.vtc: Rename to tests/test02.vti, add conditional compilation directives.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--NEWS11
-rw-r--r--configure.ac14
-rw-r--r--src/.gitignore1
-rw-r--r--src/Makefile.am31
-rw-r--r--src/getla.c11
-rw-r--r--src/sleep.c8
-rw-r--r--src/tbf.c30
-rw-r--r--src/tbf.h38
-rw-r--r--src/time.c23
-rw-r--r--src/vmod_tbf.vcc47
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/Makefile.am31
-rw-r--r--tests/test00.vti (renamed from tests/test00.vtc)6
-rw-r--r--tests/test02.vti (renamed from tests/test02.vtc)6
14 files changed, 183 insertions, 76 deletions
diff --git a/NEWS b/NEWS
index 9c771b3..f5bcc13 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,15 @@
1vmod-tbf -- history of user-visible changes. 2013-10-19 1vmod-tbf -- history of user-visible changes. 2014-10-31
2Copyright (C) 2013 Sergey Poznyakoff 2Copyright (C) 2013-2014 Sergey Poznyakoff
3See the end of file for copying conditions. 3See the end of file for copying conditions.
4 4
5Please send vmod-tbf bug reports to <gray@gnu.org> 5Please send vmod-tbf bug reports to <gray@gnu.org>
6 6
7 7
8Version 1.0.90 (git)
9
10Support for VCL 4.0
11
12
8Version 1.0, 2013-10-19 13Version 1.0, 2013-10-19
9 14
10Initial release 15Initial release
@@ -12,7 +17,7 @@ Initial release
12========================================================================= 17=========================================================================
13Copyright information: 18Copyright information:
14 19
15Copyright (C) 2013 Sergey Poznyakoff 20Copyright (C) 2013-2014 Sergey Poznyakoff
16 21
17 Permission is granted to anyone to make or distribute verbatim copies 22 Permission is granted to anyone to make or distribute verbatim copies
18 of this document as received, in any medium, provided that the 23 of this document as received, in any medium, provided that the
diff --git a/configure.ac b/configure.ac
index 6af8fd6..70fd78d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@
14# You should have received a copy of the GNU General Public License 14# You should have received a copy of the GNU General Public License
15# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>. 15# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
16AC_PREREQ(2.69) 16AC_PREREQ(2.69)
17AC_INIT([vmod-tbf], 1.0, [gray@gnu.org]) 17AC_INIT([vmod-tbf], 1.0.90, [gray@gnu.org])
18AC_CONFIG_AUX_DIR([build-aux]) 18AC_CONFIG_AUX_DIR([build-aux])
19AC_CONFIG_MACRO_DIR([m4]) 19AC_CONFIG_MACRO_DIR([m4])
20AC_CONFIG_SRCDIR(src/vmod_tbf.vcc) 20AC_CONFIG_SRCDIR(src/vmod_tbf.vcc)
@@ -67,9 +67,17 @@ case "$VARNISHSRC" in
67esac 67esac
68 68
69VARNISHSRC=`cd $VARNISHSRC && pwd` 69VARNISHSRC=`cd $VARNISHSRC && pwd`
70VARNISHVERSION=
70AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h], 71AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h],
71 [], 72 [VARNISHVERSION=3],
72 [AC_MSG_FAILURE(["$VARNISHSRC" is not a Varnish source directory])]) 73 [AC_CHECK_FILE([$VARNISHSRC/include/vapi/vsm.h],
74 [VARNISHVERSION=4],
75 [AC_MSG_FAILURE(["$VARNISHSRC" is not a Varnish source directory])]) ])
76AC_SUBST([VARNISHVERSION],$VARNISHVERSION)
77
78AC_DEFINE_UNQUOTED([VARNISHVERSION],$VARNISHVERSION,[Varnish major version number])
79AM_CONDITIONAL([VARNISH3],[test $VARNISHVERSION -eq 3])
80AM_CONDITIONAL([VARNISH4],[test $VARNISHVERSION -eq 4])
73 81
74# Check that varnishtest is built in the varnish source directory 82# Check that varnishtest is built in the varnish source directory
75AC_CHECK_FILE([$VARNISHSRC/bin/varnishtest/varnishtest], 83AC_CHECK_FILE([$VARNISHSRC/bin/varnishtest/varnishtest],
diff --git a/src/.gitignore b/src/.gitignore
index 7f6e438..ce7aef0 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,2 +1,3 @@
1vcc_if.c 1vcc_if.c
2vcc_if.h 2vcc_if.h
3*.rst
diff --git a/src/Makefile.am b/src/Makefile.am
index 727d33b..f4e3bec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,6 +16,7 @@
16 16
17AM_CPPFLAGS=\ 17AM_CPPFLAGS=\
18 -I$(VARNISHSRC)/include\ 18 -I$(VARNISHSRC)/include\
19 -I$(VARNISHSRC)/bin/varnishd\
19 -I$(VARNISHSRC)\ 20 -I$(VARNISHSRC)\
20 -DLOCALSTATEDIR=\"$(localstatedir)\" 21 -DLOCALSTATEDIR=\"$(localstatedir)\"
21 22
@@ -28,19 +29,37 @@ libvmod_tbf_la_LDFLAGS=-module -export-dynamic -avoid-version
28libvmod_tbf_la_LIBADD= 29libvmod_tbf_la_LIBADD=
29 30
30libvmod_tbf_la_SOURCES = \ 31libvmod_tbf_la_SOURCES = \
32 tbf.c\
33 tbf.h\
31 getla.c\ 34 getla.c\
32 sleep.c\ 35 sleep.c\
33 time.c\ 36 time.c
34 tbf.c\ 37nodist_libvmod_tbf_la_SOURCES = \
35 vcc_if.c vcc_if.h 38 vcc_if.c vcc_if.h
36 39
37BUILT_SOURCES = vcc_if.c vcc_if.h 40tbf.lo: vcc_if.h
41
42CLEANFILES = vcc_if.c vcc_if.h *.rst
43
44if VARNISH4
45 vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py
46 vmodtoolargs = --strict
47 vccfile = $(top_srcdir)/src/vmod_tbf.vcc
48else
49 vmodtool = $(VARNISHSRC)/lib/libvmod_std/vmod.py
50 vmodtoolargs =
51 vccfile = vmod_tbf.vcc3
52
53vmod_tbf.vcc3: $(top_srcdir)/src/vmod_tbf.vcc
54 CLEANFILES += vmod_tbf.vcc3
55endif
38 56
39vcc_if.c vcc_if.h: $(VARNISHSRC)/lib/libvmod_std/vmod.py $(top_srcdir)/src/vmod_tbf.vcc 57.vcc.vcc3:
40 @PYTHON@ $(VARNISHSRC)/lib/libvmod_std/vmod.py $(top_srcdir)/src/vmod_tbf.vcc 58 sed -n '/^\$$/{s///;s/\(Module *[^ ][^ ]*\).*/\1/;p}' $< > $@
59vcc_if.c vcc_if.h: $(vmodtool) $(vccfile)
60 @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vccfile)
41 61
42EXTRA_DIST = \ 62EXTRA_DIST = \
43 vmod_tbf.vcc 63 vmod_tbf.vcc
44 64
45CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h
46 65
diff --git a/src/getla.c b/src/getla.c
index c735956..51791c4 100644
--- a/src/getla.c
+++ b/src/getla.c
@@ -15,15 +15,10 @@
15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#define _BSD_SOURCE 17#define _BSD_SOURCE
18#include <config.h> 18#include "tbf.h"
19#include <stdlib.h>
20#include <stdio.h>
21#include <syslog.h>
22#if defined(HAVE_SYSINFO) && defined(HAVE_SYS_SYSINFO_H) 19#if defined(HAVE_SYSINFO) && defined(HAVE_SYS_SYSINFO_H)
23# include <sys/sysinfo.h> 20# include <sys/sysinfo.h>
24#endif 21#endif
25#include "vrt.h"
26#include "vcc_if.h"
27 22
28static double 23static double
29sys_getla(int what) 24sys_getla(int what)
@@ -50,8 +45,8 @@ sys_getla(int what)
50 #endif 45 #endif
51} 46}
52 47
53double 48VCL_REAL
54vmod_getla(struct sess *sp, int what) 49vmod_getla(MOD_CTX ctx, VCL_INT what)
55{ 50{
56 switch (what) { 51 switch (what) {
57 case 1: 52 case 1:
diff --git a/src/sleep.c b/src/sleep.c
index 70c4337..9242475 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -14,14 +14,12 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <config.h> 17#include "tbf.h"
18#include <errno.h> 18#include <errno.h>
19#include <time.h> 19#include <time.h>
20#include "vrt.h"
21#include "vcc_if.h"
22 20
23void 21VCL_VOID
24vmod_sleep(struct sess *sp, double t) 22vmod_sleep(MOD_CTX ctx, VCL_REAL t)
25{ 23{
26 struct timespec ts, ret; 24 struct timespec ts, ret;
27 25
diff --git a/src/tbf.c b/src/tbf.c
index 7050fc7..56a4ad1 100644
--- a/src/tbf.c
+++ b/src/tbf.c
@@ -14,17 +14,12 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <config.h> 17#include "tbf.h"
18#include <stdlib.h>
19#include <stdio.h>
20#include <stdbool.h>
21#include <syslog.h> 18#include <syslog.h>
22#include <inttypes.h> 19#include <inttypes.h>
23#include <sys/stat.h> 20#include <sys/stat.h>
21#include <sys/time.h>
24#include <db.h> 22#include <db.h>
25#include "vrt.h"
26#include "vcc_if.h"
27#include "bin/varnishd/cache.h"
28 23
29static int debug_level; 24static int debug_level;
30 25
@@ -351,7 +346,7 @@ tbf_init(struct vmod_priv *priv, const struct VCL_conf *vclconf)
351} 346}
352 347
353void 348void
354vmod_open(struct sess *sp, const char *dir, const char *params) 349vmod_open(MOD_CTX ctx, const char *dir, const char *params)
355{ 350{
356 if (db) { 351 if (db) {
357 syslog(LOG_DAEMON|LOG_ERR, "tbf.open called twice"); 352 syslog(LOG_DAEMON|LOG_ERR, "tbf.open called twice");
@@ -362,7 +357,7 @@ vmod_open(struct sess *sp, const char *dir, const char *params)
362} 357}
363 358
364void 359void
365vmod_close(struct sess *sp) 360vmod_close(MOD_CTX ctx)
366{ 361{
367 pthread_mutex_lock(&mutex); 362 pthread_mutex_lock(&mutex);
368 if (db) { 363 if (db) {
@@ -377,7 +372,7 @@ vmod_close(struct sess *sp)
377} 372}
378 373
379void 374void
380vmod_sync(struct sess *sp) 375vmod_sync(MOD_CTX ctx)
381{ 376{
382 if (db) { 377 if (db) {
383 debug(1, ("synchronizing database")); 378 debug(1, ("synchronizing database"));
@@ -410,7 +405,7 @@ struct tbf_bucket {
410}; 405};
411 406
412int 407int
413tbf_proc(struct sess *sp, DB *db, const char *key, int cost, 408tbf_proc(MOD_CTX ctx, DB *db, const char *key, int cost,
414 unsigned long interval, int burst_size) 409 unsigned long interval, int burst_size)
415{ 410{
416 DBT keydat, content; 411 DBT keydat, content;
@@ -499,8 +494,9 @@ tbf_proc(struct sess *sp, DB *db, const char *key, int cost,
499 return res; 494 return res;
500} 495}
501 496
502unsigned 497VCL_BOOL
503vmod_rate(struct sess *sp, const char *key, int cost, double t, int burst_size) 498vmod_rate(MOD_CTX ctx, VCL_STRING key, VCL_INT cost, VCL_REAL t,
499 VCL_INT burst_size)
504{ 500{
505 unsigned long interval = t * USEC_PER_SEC; 501 unsigned long interval = t * USEC_PER_SEC;
506 int rc; 502 int rc;
@@ -527,7 +523,7 @@ vmod_rate(struct sess *sp, const char *key, int cost, double t, int burst_size)
527 kp = keylock_find_safe(key); 523 kp = keylock_find_safe(key);
528 debug(2, ("found key %s, ref %u", key, kp->refcnt)); 524 debug(2, ("found key %s, ref %u", key, kp->refcnt));
529 AZ(pthread_mutex_lock(&kp->mutex)); 525 AZ(pthread_mutex_lock(&kp->mutex));
530 rc = tbf_proc(sp, db, key, cost, interval, burst_size); 526 rc = tbf_proc(ctx, db, key, cost, interval, burst_size);
531 if (--kp->refcnt == 0) 527 if (--kp->refcnt == 0)
532 keylock_remove_safe(kp); 528 keylock_remove_safe(kp);
533 AZ(pthread_mutex_unlock(&kp->mutex)); 529 AZ(pthread_mutex_unlock(&kp->mutex));
@@ -539,8 +535,8 @@ vmod_rate(struct sess *sp, const char *key, int cost, double t, int burst_size)
539 535
540#define ISWS(c) ((c)==' '||(c)=='\t') 536#define ISWS(c) ((c)==' '||(c)=='\t')
541 537
542unsigned 538VCL_BOOL
543vmod_check(struct sess *sp, const char *key, const char *spec) 539vmod_check(MOD_CTX ctx, VCL_STRING key, VCL_STRING spec)
544{ 540{
545 double t, v, n; 541 double t, v, n;
546 char *p; 542 char *p;
@@ -601,5 +597,5 @@ vmod_check(struct sess *sp, const char *key, const char *spec)
601 syslog(LOG_DAEMON|LOG_WARNING, "garbage after rate spec: %s", 597 syslog(LOG_DAEMON|LOG_WARNING, "garbage after rate spec: %s",
602 spec); 598 spec);
603 599
604 return vmod_rate(sp, key, 1, n/v, v/n+1); 600 return vmod_rate(ctx, key, 1, n/v, v/n+1);
605} 601}
diff --git a/src/tbf.h b/src/tbf.h
new file mode 100644
index 0000000..3c7a118
--- a/dev/null
+++ b/src/tbf.h
@@ -0,0 +1,38 @@
1/* This file is part of vmod-tbf
2 Copyright (C) 2013-2014 Sergey Poznyakoff
3
4 Vmod-tbf is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 Vmod-tbf is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <config.h>
18#include <stdlib.h>
19#include <stdio.h>
20#include <stdbool.h>
21#include <syslog.h>
22#include "vrt.h"
23#include "vcc_if.h"
24#include "pthread.h"
25#if VARNISHVERSION == 3
26# include "bin/varnishd/cache.h"
27# define VCL_VOID void
28# define VCL_INT int
29# define VCL_REAL double
30# define VCL_BOOL unsigned
31# define VCL_STRING const char *
32# define MOD_CTX struct sess *
33# define WSPTR(s) ((s)->wrk->ws)
34#else
35# include "bin/varnishd/cache/cache.h"
36# define MOD_CTX const struct vrt_ctx *
37# define WSPTR(s) ((s)->ws)
38#endif
diff --git a/src/time.c b/src/time.c
index 01919de..9a5068b 100644
--- a/src/time.c
+++ b/src/time.c
@@ -14,36 +14,31 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <config.h> 17#include "tbf.h"
18#include <stdlib.h>
19#include <stdio.h>
20#include <time.h> 18#include <time.h>
21#include "vrt.h"
22#include "vcc_if.h"
23#include "bin/varnishd/cache.h"
24 19
25int 20VCL_INT
26vmod_systime(struct sess *sp) 21vmod_systime(MOD_CTX ctx)
27{ 22{
28 return time(NULL); 23 return time(NULL);
29} 24}
30 25
31const char * 26VCL_STRING
32vmod_strftime(struct sess *sp, const char *format, int timestamp) 27vmod_strftime(MOD_CTX ctx, VCL_STRING format, VCL_INT timestamp)
33{ 28{
34 time_t ts = (time_t) timestamp; 29 time_t ts = (time_t) timestamp;
35 size_t u, n; 30 size_t u, n;
36 char *p; 31 char *p;
37 32
38 u = WS_Reserve(sp->wrk->ws, 0); 33 u = WS_Reserve(WSPTR(ctx), 0);
39 p = sp->wrk->ws->f; 34 p = WSPTR(ctx)->f;
40 n = strftime(p, u, format, gmtime(&ts)); 35 n = strftime(p, u, format, gmtime(&ts));
41 if (n == 0) { 36 if (n == 0) {
42 WS_Release(sp->wrk->ws, 0); 37 WS_Release(WSPTR(ctx), 0);
43 return NULL; 38 return NULL;
44 } 39 }
45 40
46 WS_Release(sp->wrk->ws, n + 1); 41 WS_Release(WSPTR(ctx), n + 1);
47 42
48 return p; 43 return p;
49} 44}
diff --git a/src/vmod_tbf.vcc b/src/vmod_tbf.vcc
index 3634807..b27093b 100644
--- a/src/vmod_tbf.vcc
+++ b/src/vmod_tbf.vcc
@@ -1,11 +1,36 @@
1Module tbf 1# This file is part of vmod-tbf
2Init tbf_init 2# Copyright (C) 2013 Sergey Poznyakoff
3Function VOID open(STRING, STRING) 3#
4Function VOID close() 4# Vmod-tbf is free software; you can redistribute it and/or modify
5Function VOID sync() 5# it under the terms of the GNU General Public License as published by
6Function BOOL rate(STRING, INT, DURATION, INT) 6# the Free Software Foundation; either version 3, or (at your option)
7Function BOOL check(STRING, STRING) 7# any later version.
8Function REAL getla(INT) 8#
9Function INT systime() 9# Vmod-tbf is distributed in the hope that it will be useful,
10Function STRING strftime(STRING, INT) 10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11Function VOID sleep(DURATION) 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
16
17$Module tbf 3 Token Bucket Filtering for Varnish
18
19COLOPHON
20========
21This document provides a short description of the **vmod-tbf** module.
22For a detailed documentation, please see vmod-tbf(3) manual page.
23
24DESCRIPTION
25===========
26
27$Init tbf_init
28$Function VOID open(STRING, STRING)
29$Function VOID close()
30$Function VOID sync()
31$Function BOOL rate(STRING, INT, DURATION, INT)
32$Function BOOL check(STRING, STRING)
33$Function REAL getla(INT)
34$Function INT systime()
35$Function STRING strftime(STRING, INT)
36$Function VOID sleep(DURATION)
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..6f6760a
--- a/dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,2 @@
1test00.vtc
2test02.vtc
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4790115..0f90aa7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,17 +1,38 @@
1VMOD_VTC = \
2 test01.vtc\
3 test03.vtc\
4 time00.vtc
5
6VMOD_VTI = \
7 test00.vti\
8 test02.vti
9
10BUILT_TESTS = $(VMOD_VTI:.vti=.vtc)
11
1VMOD_TESTS = \ 12VMOD_TESTS = \
2 test00.vtc\ 13 test00.vti\
3 test01.vtc\ 14 test01.vtc\
4 test02.vtc\ 15 test02.vti\
5 test03.vtc\ 16 test03.vtc\
6 time00.vtc 17 time00.vtc
7 18
8EXTRA_DIST=$(VMOD_TESTS) 19.vti.vtc:
20 sed 's/^#VARNISH$(VARNISHVERSION)#//' $< > $@
21
22EXTRA_DIST=$(VMOD_VTC) $(VMOD_VTI)
23CLEANFILES=$(BUILT_TESTS)
24
9distclean-local: 25distclean-local:
10 rm -fr tbf 26 rm -fr tbf
11 27
12check: 28check: $(BUILT_TESTS)
13 cd $(abs_srcdir); \
14 for t in $(VMOD_TESTS); do \ 29 for t in $(VMOD_TESTS); do \
30 n=$${t%%.vti}; \
31 if [ $$n != $$t ]; then \
32 t=$(abs_builddir)/$${n}.vtc;\
33 else \
34 t=$(abs_srcdir)/$$t;\
35 fi; \
15 $(VARNISHSRC)/bin/varnishtest/varnishtest \ 36 $(VARNISHSRC)/bin/varnishtest/varnishtest \
16 -Dvarnishd=$(VARNISHSRC)/bin/varnishd/varnishd \ 37 -Dvarnishd=$(VARNISHSRC)/bin/varnishd/varnishd \
17 -Dvmod_topsrc=$(abs_top_srcdir) \ 38 -Dvmod_topsrc=$(abs_top_srcdir) \
diff --git a/tests/test00.vtc b/tests/test00.vti
index f69f5ed..05084c7 100644
--- a/tests/test00.vtc
+++ b/tests/test00.vti
@@ -15,9 +15,11 @@ varnish v1 -vcl+backend {
15 } 15 }
16 sub vcl_recv { 16 sub vcl_recv {
17 if (!tbf.rate("url:"+req.url, 1, 20 s, 5)) { 17 if (!tbf.rate("url:"+req.url, 1, 20 s, 5)) {
18 error 420 "Overlimit"; 18 #VARNISH3# error 420 "Overlimit";
19 #VARNISH4# return (synth(420, "Overlimit"));
19 } 20 }
20 return (lookup); 21 #VARNISH3#return (lookup);
22 #VARNISH4#return (hash);
21 } 23 }
22} -start 24} -start
23 25
diff --git a/tests/test02.vtc b/tests/test02.vti
index 8df6730..1b5e6b3 100644
--- a/tests/test02.vtc
+++ b/tests/test02.vti
@@ -15,9 +15,11 @@ varnish v1 -vcl+backend {
15 } 15 }
16 sub vcl_recv { 16 sub vcl_recv {
17 if (!tbf.check("url:"+req.url, "4 req/s")) { 17 if (!tbf.check("url:"+req.url, "4 req/s")) {
18 error 420 "Overlimit"; 18 #VARNISH3# error 420 "Overlimit";
19 #VARNISH4# return (synth(420, "Overlimit"));
19 } 20 }
20 return (lookup); 21 #VARNISH3#return (lookup);
22 #VARNISH4#return (hash);
21 } 23 }
22} -start 24} -start
23 25

Return to:

Send suggestions and report system problems to the System administrator.