aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am13
-rw-r--r--README51
m---------acvmod0
-rw-r--r--configure.ac4
-rw-r--r--git2chg.awk75
-rw-r--r--src/Makefile.am11
-rw-r--r--src/dbrw.h4
-rw-r--r--src/vmod_dbrw.c10
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/atlocal.in13
10 files changed, 54 insertions, 129 deletions
diff --git a/Makefile.am b/Makefile.am
index e2af33e..a5248b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of vmod-dbrw
-# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-dbrw is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,14 +17,5 @@ ACLOCAL_AMFLAGS = -I m4 -I acvmod
SUBDIRS = src doc tests
-AM_DISTCHECK_CONFIGURE_FLAGS=--without-vmoddir
-
-EXTRA_DIST=git2chg.awk
-
-.PHONY: ChangeLog
-ChangeLog:
- $(AM_V_GEN)if test -d .git; then \
- git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \
- awk -f $(top_srcdir)/git2chg.awk > ChangeLog; \
- fi
+include acvmod/top.am
diff --git a/README b/README
index 93f6f7e..c4dbbdd 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
Vmod-dbrw README
-Copyright (C) 2013-2014 Sergey Poznyakoff
+Copyright (C) 2013-2017 Sergey Poznyakoff
See the end of file for copying conditions.
* Introduction
@@ -50,12 +50,9 @@ VCL 3.x code:
import dbrw;
- sub vcl_init {
+ sub vcl_recv {
dbrw.config("mysql", "database=dbname;user=varnish;debug=1",
"SELECT dest FROM redirects WHERE host='$host' AND url='$url'");
- }
-
- sub vcl_recv {
set req.http.X-Redirect-To =
dbrw.rewrite("host=" + req.http.Host + ";" +
"url=" + req.url);
@@ -76,13 +73,10 @@ VCL 4.0 code:
import dbrw;
- sub vcl_init {
- dbrw.config("mysql", "database=dbname;user=varnish;debug=1",
- "SELECT dest FROM redirects WHERE host='$host' AND url='$url'");
- }
-
sub vcl_recv {
- set req.http.X-Redirect-To =
+ dbrw.config("mysql", "database=dbname;user=varnish;debug=1",
+ "SELECT dest FROM redirects WHERE host='$host' AND url='$url'");
+ set req.http.X-Redirect-To =
dbrw.rewrite("host=" + req.http.Host + ";" +
"url=" + req.url);
if (req.http.X-Redirect-To != "") {
@@ -110,9 +104,9 @@ Table structure:
KEY source (host,url)
)
-VCL code differs only in definition of the vcl_init:
+The VCL code differs only in the call to dbrw.config in vcl_recv:
- sub vcl_init {
+ sub vcl_recv {
dbrw.config("mysql", "database=varnish;user=varnish;debug=10",
{"SELECT dest,pattern,value FROM rewrite
WHERE host='$host' and '$url' like url"});
@@ -120,18 +114,33 @@ VCL code differs only in definition of the vcl_init:
* Installation
-In order to compile the package you need to have Varnish source tree.
-Both Varnish 3.x and 4.x are supported. Supposing that the Varnish
-source tree is available under /usr/src/varnish-3.0.1, run:
+In order to compile the package you need to have installed
+varnishd and varnishapi package.
- ./configure --with-varnish-source=/usr/src/varnish-3.0.1
+Supposing that condition is met, run:
+
+ ./configure
+
+It should be able to automatically find the necessary components. In case
+it doesn't, tweak the configuration variables as necessary. The most
+important one is PKG_CONFIG_PATH, which contains a path (in the UNIX sense)
+where the .pc files are located. It should contain a directory where the
+'varnishapi.pc' file lives. Example usage:
+
+ ./configure PKG_CONFIG_PATH=/usr/local/varnish/lib/pkgconfig:$PKG_CONFIG_PATH
+
+Please read the file INSTALL for a detailed discussion of available variables
+and command line options.
Once configured, do
-
+
make
-This will build the module. Finally, do the following command as root:
-
+This will build the module. After this step you can optionally run
+'make test' to test the package.
+
+Finally, run the following command as root:
+
make install
* Testing
@@ -237,7 +246,7 @@ Send bug reports and suggestions to <gray@gnu.org>
* Copyright information:
-Copyright (C) 2013-2014 Sergey Poznyakoff
+Copyright (C) 2013-2017 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
diff --git a/acvmod b/acvmod
-Subproject f064cf4d7aa1ead1f8607b8b72baf883f015ffc
+Subproject ba32780019480b89cd9d796b93a76cae6afe99a
diff --git a/configure.ac b/configure.ac
index becaeef..bdb9df5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
# This file is part of vmod-dbrw -*- autoconf -*-
-# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-dbrw is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.69)
-AC_INIT([vmod-dbrw], 2.0.91-4.1.0, [gray@gnu.org])
+AC_INIT([vmod-dbrw], 2.0.92, [gray@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/vmod_dbrw.vcc)
diff --git a/git2chg.awk b/git2chg.awk
deleted file mode 100644
index 48c0ec9..0000000
--- a/git2chg.awk
+++ /dev/null
@@ -1,75 +0,0 @@
-# This file is part of grecs
-# Copyright (C) 2007, 2009-2014 Sergey Poznyakoff
-#
-# Grecs 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.
-#
-# Grecs is distributed in the hope that it will be useful,
-# 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 Grecs. If not, see <http://www.gnu.org/licenses/>.
-
-BEGIN {
- if (since)
- split(since,since_a,"-")
-}
-
-function timeok(t, a) {
- if (!since)
- return 1
- split(t,a,"-")
- if (a[1] < since_a[1])
- return 0
- if (a[1] > since_a[1])
- return 1
- if (a[2] < since_a[2])
- return 0
- if (a[2] > since_a[2])
- return 1
- return a[3] > since_a[3]
-}
-
-/^[0-9]+ .* +<[^>]+>/ {
- s = strftime("%F", $1)
- if (!timeok(s))
- exit
- sub(/^[0-9]+ +/,"")
- if (s == datestr && author == $0)
- next
- datestr = s
- author = $0
- if (runlen) { runlen = 0; print "" }
- printf("%s %s\n", datestr, author)
- next
-}
-/^Signed-off-by:/ { next }
-/^<unknown>$/ { next }
-NF==0 {
- runlen++
- next
-}
-{ if (runlen) { runlen = 0; print "" }
- print "\t" $0 }
-
-END {
- if (append) {
- print ""
- while ((getline < append) > 0) {
- if (match($0, /^Local *Variables:/))
- break
- print
- }
- }
- print "\f"
- # Make sure Emacs won't recognize this line:
- print "Local", "Variables:"
- print "mode: change-log"
- print "version-control: never"
- print "buffer-read-only: t"
- print "End:"
-}
diff --git a/src/Makefile.am b/src/Makefile.am
index 00110d9..f971354 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of vmod-dbrw
-# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-dbrw is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,11 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
-AM_CPPFLAGS =\
- -I$(VARNISHSRC)/include\
- -I$(VARNISHSRC)/bin/varnishd\
- -I$(VARNISHSRC)
-
+AM_CPPFLAGS=$(VARNISHAPI_CFLAGS) -I.
noinst_LTLIBRARIES = libsql.la
libsql_la_SOURCES = \
be.c\
@@ -50,12 +46,11 @@ vmod_dbrw.lo: vcc_if.h
CLEANFILES = vcc_if.c vcc_if.h *.rst
-vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py
vmodtoolargs = --strict
vccfile = $(top_srcdir)/src/vmod_dbrw.vcc
vcc_if.c vcc_if.h: $(vmodtool) $(vccfile)
- $(AM_V_GEN)$(PYTHON) $(vmodtool) $(vmodtoolargs) $(vccfile)
+ $(AM_V_GEN)$(PYTHON) $(VARNISHAPI_VMODTOOL) $(vmodtoolargs) $(vccfile)
EXTRA_DIST = \
vmod_dbrw.vcc
diff --git a/src/dbrw.h b/src/dbrw.h
index 2156e0b..438d963 100644
--- a/src/dbrw.h
+++ b/src/dbrw.h
@@ -1,5 +1,5 @@
/* This file is part of vmod-dbrw
- Copyright (C) 2013-2014 Sergey Poznyakoff
+ Copyright (C) 2013-2017 Sergey Poznyakoff
Vmod-dbrw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
#include "vcl.h"
#include "vrt.h"
#include "vcc_if.h"
-#include "bin/varnishd/cache/cache.h"
+#include "cache/cache.h"
#define WSPTR(s) ((s)->ws)
struct dbrw_connection;
diff --git a/src/vmod_dbrw.c b/src/vmod_dbrw.c
index c3436f8..9a0f2c3 100644
--- a/src/vmod_dbrw.c
+++ b/src/vmod_dbrw.c
@@ -198,7 +198,6 @@ parse_flags(const char *arg, int *qdisp, int *flags, char status[])
return rc;
}
-
/* Configure the module.
BACKEND - "mysql" or "pgsql"
PARAM - VAR=VALUE*:
@@ -217,7 +216,7 @@ vmod_config(VRT_CTX, struct vmod_priv *priv,
{
struct dbrw_config *conf;
struct dbrw_backend *backend;
-
+
AZ(priv->priv);
backend = dbrw_backend_select(bkname);
if (!backend) {
@@ -571,3 +570,10 @@ vmod_rewrite(VRT_CTX, struct vmod_priv *priv, VCL_STRING arg)
debug(conf, 1, ("vmod_rewrite: res=%s", res ? res : "(NULL)"));
return res;
}
+wd()
+{
+ int volatile _st=0;
+ while (!_st) {
+ _st=_st;
+ }
+}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4ca2c94..7d1b99d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -76,7 +76,7 @@ check_PROGRAMS = initdb
initdb_SOURCES = initdb.c
initdb_LDADD = ../src/libsql.la
initdb_CFLAGS = $(AM_CFLAGS)
-AM_CPPFLAGS = -I$(top_srcdir)/src
+AM_CPPFLAGS = $(VARNISHAPI_CFLAGS) -I$(top_srcdir)/src
diff --git a/tests/atlocal.in b/tests/atlocal.in
index c5ee511..b8b4066 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -1,12 +1,13 @@
# @configure_input@ -*- shell-script -*-
# Configurable variable values for vmod-dbrw test suite.
-# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
PATH=@abs_builddir@:@abs_top_builddir@/src:@abs_top_srcdir@/build-aux:$top_srcdir:$srcdir:$PATH
INITFILE=@abs_builddir@/.TESTINIT
FAILFILE=@abs_builddir@/FAILURE
-VARNISHTEST="@VARNISHSRC@/bin/varnishtest/varnishtest -Dvarnishd=@VARNISHSRC@/bin/varnishd/varnishd"
-VARNISHVERSION=@VARNISHVERSION@
+VARNISHD=@VARNISHD@
+VARNISHTEST="@VARNISHTEST@ -Dvarnishd=$VARNISHD"
+VARNISHVERSION=@VARNISH_MAJOR@
: ${DBRW_TEST_DBTYPE=@DBRW_TEST_DBTYPE@}
: ${DBRW_TEST_PARAMS=@DBRW_TEST_PARAMS@}
: ${DBRW_TEST_SERVER=@DBRW_TEST_SERVER@}
@@ -41,12 +42,10 @@ server s1 {
varnish v1 -vcl+backend {
import std;
import dbrw from "$abs_top_builddir/src/.libs/libvmod_dbrw.so";
- sub vcl_init {
- dbrw.config("$DBRW_TEST_DBTYPE", "$DBRW_TEST_PARAMS",
- {"$1"});
- }
sub vcl_recv {
+ dbrw.config("$DBRW_TEST_DBTYPE", "$DBRW_TEST_PARAMS",
+ {"$1"});
set req.http.X-Redirect-To =
dbrw.rewrite("host=" + req.http.Host + ";" +
"url=" + req.url);

Return to:

Send suggestions and report system problems to the System administrator.