diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-01-24 00:10:28 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-01-24 00:10:28 +0200 |
commit | e1135c7194d612b56f337202186c66115f9cdf67 (patch) | |
tree | 5bccd02c07601248dbb2abc79af24b096e7931fd | |
parent | 6d4086e39c5cbe1011d7a3fc67902e0c199a5b21 (diff) | |
download | vmod-binlog-e1135c7194d612b56f337202186c66115f9cdf67.tar.gz vmod-binlog-e1135c7194d612b56f337202186c66115f9cdf67.tar.bz2 |
Varnish 4.1
* .gitmodules: New file.
* acvmod: New submodule.
* bootstrap: Update.
* Makefile.am (ACLOCAL_AMFLAGS): Add acvmod
* configure.ac: Use AM_VARNISHAPI instead of inlining
the related code.
Enable silent rules.
Set version number 2.0.90-4.1.0
* src/vmod.vcc: Use $Event instead of $Init
* src/binlog.c: Declare event function.
* src/Makefile.am: Enable silent rules.
* tests/Makefile.am: Likewise.
* tests/atlocal.in (ret_vcl_recv): Remove variable.
* tests/test01.at: Likewise.
* tests/test02.at: Likewise.
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | NEWS | 15 | ||||
m--------- | acvmod | 0 | ||||
-rwxr-xr-x | bootstrap | 2 | ||||
-rw-r--r-- | configure.ac | 75 | ||||
-rw-r--r-- | src/Makefile.am | 22 | ||||
-rw-r--r-- | src/binlog.c | 29 | ||||
-rw-r--r-- | src/vmod.vcc | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/atlocal.in | 2 | ||||
-rw-r--r-- | tests/test01.at | 2 | ||||
-rw-r--r-- | tests/test02.at | 2 |
13 files changed, 51 insertions, 119 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..00ae21c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "acvmod"] + path = acvmod + url = git://git.gnu.org.ua/acvmod.git diff --git a/Makefile.am b/Makefile.am index 75bb714..9c03c59 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,8 @@ # This file is part of vmod-binlog -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # @@ -10,13 +10,13 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with vmod-binlog. If not, see <http://www.gnu.org/licenses/>. -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -I acvmod SUBDIRS = libltdl src tests doc AM_DISTCHECK_CONFIGURE_FLAGS=--without-vmoddir EXTRA_DIST=git2chg.awk @@ -1,25 +1,34 @@ -Vmod-binlog NEWS -- history of user-visible changes. 2014-11-13 -Copyright (C) 2013-2014 Sergey Poznyakoff +Vmod-binlog NEWS -- history of user-visible changes. 2016-01-24 +Copyright (C) 2013-2016 Sergey Poznyakoff See the end of file for copying conditions. Please send Vmod-binlog bug reports to <gray@gnu.org> +Version 2.0.90-4.1.0 (Git) + +* Versioning changes + +Starting with this release, the version number includes version +of Varnish API the release was designed for. + +* Support for Varnish 4,1 + Version 2,0, 2014-11-13 Support for VCL 4.0 Version 1.0, 2013-10-19 Initial release. * Copyright information: -Copyright (C) 2013-2014 Sergey Poznyakoff +Copyright (C) 2013-2016 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the copyright notice and this permission notice are preserved, thus giving the recipient permission to redistribute in turn. diff --git a/acvmod b/acvmod new file mode 160000 +Subproject f064cf4d7aa1ead1f8607b8b72baf883f015ffc @@ -1,7 +1,9 @@ #!/bin/sh for dir in m4 build-aux do test -d $dir || mkdir $dir done +git submodule init +git submodule update test -f ChangeLog || touch ChangeLog autoreconf -f -i -s diff --git a/configure.ac b/configure.ac index d82cee6..3be0b79 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ # This file is part of vmod-binlog -# Copyright (C) 2013, 2014 Sergey Poznyakoff +# Copyright (C) 2013, 2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # @@ -11,22 +11,23 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with vmod-binlog. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ(2.69) -AC_INIT([vmod-binlog], 2.0, [gray@gnu.org]) +AC_INIT([vmod-binlog], 2.0.90-4.1.0, [gray@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(src/binlog.c) AM_CONFIG_HEADER(config.h) AC_CANONICAL_SYSTEM AC_LANG(C) -AM_INIT_AUTOMAKE([1.14 gnu tar-ustar subdir-objects]) +AM_INIT_AUTOMAKE([1.14 gnu tar-ustar subdir-objects silent-rules]) +AM_SILENT_RULES([yes]) AC_GNU_SOURCE AC_PROG_CC AC_PROG_CC_STDC AM_PROG_CC_C_O if test "x$ac_cv_prog_cc_c99" = xno; then @@ -41,93 +42,27 @@ AC_PROG_MAKE_SET LT_PREREQ(2.2.5a) LT_CONFIG_LTDL_DIR([libltdl]) LT_INIT([dlopen]) LTDL_INIT([recursive]) AC_CONFIG_FILES([libltdl/Makefile]) -# Check for pkg-config -PKG_PROG_PKG_CONFIG - AC_SYS_LARGEFILE # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([sys/stdlib.h]) -# Check for python -AC_CHECK_PROGS(PYTHON, [python], [ - AC_MSG_ERROR([python is not found.])]) - -# Varnish source tree -AC_ARG_VAR([VARNISHSRC], [path to Varnish source tree]) -AC_ARG_WITH([varnish-source], - AC_HELP_STRING([--with-varnish-source=DIR], - [Varnish sources are located in DIR]), - [VARNISHSRC=$withval]) - -if test -z "$VARNISHSRC"; then - AC_MSG_ERROR([no Varnish source tree specified]) -fi -case "$VARNISHSRC" in -/*) ;; -*) AC_MSG_ERROR([varnish source path must be absolute pathname]) -esac - -VARNISHSRC=`cd $VARNISHSRC && pwd` -VARNISHVERSION= -AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h], - [VARNISHVERSION=3], - [AC_CHECK_FILE([$VARNISHSRC/include/vapi/vsm.h], - [VARNISHVERSION=4], - [AC_MSG_FAILURE(["$VARNISHSRC" is not a Varnish source directory])]) ]) - -AC_DEFINE_UNQUOTED([VARNISHVERSION],$VARNISHVERSION,[Varnish major version number]) -AM_CONDITIONAL([VARNISH3],[test $VARNISHVERSION -eq 3]) -AM_CONDITIONAL([VARNISH4],[test $VARNISHVERSION -eq 4]) - -# Check that varnishtest is built in the varnish source directory -AC_CHECK_FILE([$VARNISHSRC/bin/varnishtest/varnishtest], - [], - [AC_MSG_FAILURE([cannot find "$VARNISHSRC/bin/varnishtest/varnishtest". Please build your varnish source directory])] -) - -# vmod installation dir -AC_ARG_VAR([VMODDIR], [vmod installation directory]) -AC_ARG_WITH([vmoddir], - AC_HELP_STRING([--with-vmoddir=DIR], - [install modules to DIR]), - [case "$withval" in - /*) VMODDIR=$withval;; - no) unset VMODDIR;; - *) AC_MSG_ERROR([argument to --with-vmoddir must be absolute pathname]) - esac],[VMODDIR=`pkg-config --variable=vmoddir varnishapi` - if test -z "$VMODDIR"; then - AC_MSG_FAILURE([cannot determine vmod installation directory]) - fi]) - - -if test -z "$VMODDIR"; then - VMODDIR='$(libdir)/varnish/mods' -fi +AM_VARNISHAPI AC_SUBST(BINLOGSEL_MODDIR,'$(libdir)/$(PACKAGE)') # Initialize the test suite. AC_CONFIG_TESTDIR(tests) AC_CONFIG_FILES([tests/Makefile tests/atlocal]) AM_MISSING_PROG([AUTOM4TE], [autom4te]) -AC_CONFIG_COMMANDS([status],[ -delim="-------------------------------------------------------------------" -echo "" -echo $delim -echo "Building for Varnish version $VARNISHVERSION" -echo $delim -], -[VARNISHVERSION=$VARNISHVERSION]) - AC_CONFIG_FILES([ Makefile src/Makefile doc/Makefile ]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 7917730..5a525de 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,8 @@ # This file is part of vmod-binlog -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # @@ -46,28 +46,16 @@ nodist_libvmod_binlog_la_SOURCES = vcc_if.c vcc_if.h noinst_HEADERS = pack.h err.h parse-datetime.h xalloc.h binlog.lo: vcc_if.c vcc_if.h CLEANFILES = vcc_if.c vcc_if.h *.rst -if VARNISH4 - vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py - vmodtoolargs = --strict - vccfile = $(top_srcdir)/src/vmod.vcc -else - vmodtool = $(VARNISHSRC)/lib/libvmod_std/vmod.py - vmodtoolargs = - vccfile = vmod.vcc3 - -vmod.vcc3: $(top_srcdir)/src/vmod.vcc - CLEANFILES += vmod.vcc3 -endif - -.vcc.vcc3: - sed -n '/^\$$/{s///;s/\(Module *[^ ][^ ]*\).*/\1/;p}' $< > $@ +vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py +vmodtoolargs = --strict +vccfile = $(top_srcdir)/src/vmod.vcc vcc_if.c vcc_if.h: $(vmodtool) $(vccfile) - @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vccfile) + $(AM_V_GEN)$(PYTHON) $(vmodtool) $(vmodtoolargs) $(vccfile) EXTRA_DIST = vmod.vcc diff --git a/src/binlog.c b/src/binlog.c index e9fb16e..1bf5950 100644 --- a/src/binlog.c +++ b/src/binlog.c @@ -1,8 +1,8 @@ /* This file is part of vmod-binlog - Copyright (C) 2013, 2014 Sergey Poznyakoff + Copyright (C) 2013, 2014, 2016 Sergey Poznyakoff Vmod-binlog is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. @@ -24,25 +24,20 @@ #include <syslog.h> #include <stddef.h> #include <stdlib.h> #include <stdarg.h> #include <ctype.h> #include <time.h> +#include "vcl.h" #include "vrt.h" #include "vcc_if.h" -#if VARNISHVERSION == 3 -# include "bin/varnishd/cache.h" -# define VCL_VOID void -# define VCL_STRING const char * -# define MOD_CTX struct sess * -# define WSPTR(s) ((s)->wrk->ws) -#else -# include "bin/varnishd/cache/cache.h" -# define MOD_CTX const struct vrt_ctx * -# define WSPTR(s) ((s)->ws) -#endif + +#include "bin/varnishd/cache/cache.h" +#define MOD_CTX const struct vrt_ctx * +#define WSPTR(s) ((s)->ws) + #include "vmod-binlog.h" #include "pack.h" #include "pthread.h" #ifndef O_SEARCH # define O_SEARCH 0 @@ -152,17 +147,19 @@ packerror(const char *fmt, ...) va_start(ap, fmt); vsyslog(LOG_DAEMON|LOG_NOTICE, fmt, ap); va_end(ap); } int -module_init(struct vmod_priv *priv, const struct VCL_conf *vclconf) +binlog_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) { - struct binlog_config *conf = calloc(1, sizeof(*conf)); - AN(conf); - priv->priv = conf; + if (e == VCL_EVENT_LOAD) { + struct binlog_config *conf = calloc(1, sizeof(*conf)); + AN(conf); + priv->priv = conf; + } return 0; } static char * findparam(const char *param, char *name) { diff --git a/src/vmod.vcc b/src/vmod.vcc index b090797..eb1a42c 100644 --- a/src/vmod.vcc +++ b/src/vmod.vcc @@ -1,8 +1,8 @@ # This file is part of vmod-binlog -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # @@ -37,13 +37,13 @@ Binary log files are rotated at preconfigured time intervals. In order to speed up searches, their names follow the strftime(3) pattern: %Y%m%dT%H%M%S.log Binary logs can be viewed using the binlogcat(1) and binlogsel(1) utilities. -$Init module_init +$Event binlog_event $Function VOID init(PRIV_VCL, STRING, STRING, STRING) Description Initializes binary log engine. Example :: diff --git a/tests/Makefile.am b/tests/Makefile.am index c77be03..ecaffca 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -47,23 +47,23 @@ TESTSUITE_AT = \ TESTSUITE = $(srcdir)/testsuite M4=m4 AUTOTEST = $(AUTOM4TE) --language=autotest $(TESTSUITE): package.m4 $(TESTSUITE_AT) - $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp - mv $@.tmp $@ + $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp + $(AM_V_at)mv $@.tmp $@ atconfig: $(top_builddir)/config.status - cd $(top_builddir) && ./config.status tests/$@ + @cd $(top_builddir) && ./config.status tests/$@ clean-local: - test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean + @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean check-local: atconfig atlocal $(TESTSUITE) - $(SHELL) $(TESTSUITE) + @$(SHELL) $(TESTSUITE) # Run the test suite on the *installed* tree. #installcheck-local: # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin check_PROGRAMS = binpack diff --git a/tests/atlocal.in b/tests/atlocal.in index 96b2d47..176b83c 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -1,9 +1,7 @@ # @configure_input@ -*- shell-script -*- # Configurable variable values for vmod-binlog test suite. # Copyright (C) 2013-2014 Sergey Poznyakoff PATH=@abs_builddir@:@abs_top_builddir@/src:@abs_top_srcdir@/build-aux:$top_srcdir:$srcdir:$PATH VARNISHTEST="@VARNISHSRC@/bin/varnishtest/varnishtest -Dvarnishd=@VARNISHSRC@/bin/varnishd/varnishd" -@VARNISH4_FALSE@ret_vcl_recv=lookup -@VARNISH4_TRUE@ret_vcl_recv=hash diff --git a/tests/test01.at b/tests/test01.at index d965b3c..d92c726 100644 --- a/tests/test01.at +++ b/tests/test01.at @@ -39,13 +39,13 @@ varnish v1 -vcl+backend { } sub vcl_recv { binlog.start(); binlog.pack(req.http.X-nid); binlog.pack(req.http.X-aid); binlog.commit(); - return ($ret_vcl_recv); + return (hash); } } -start client c1 { txreq -url / -hdr "X-nid:1" -hdr "X-aid:0" rxresp diff --git a/tests/test02.at b/tests/test02.at index fb51ef3..0313719 100644 --- a/tests/test02.at +++ b/tests/test02.at @@ -39,13 +39,13 @@ varnish v1 -vcl+backend { } sub vcl_recv { binlog.start(); binlog.pack(req.http.X-nid); binlog.pack(req.http.X-aid); binlog.commit(); - return ($ret_vcl_recv); + return (hash); } } -start client c1 { txreq -url / -hdr "X-nid:1" -hdr "X-aid:0" rxresp |