summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2013-07-20 14:50:20 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-07-20 14:50:20 (GMT)
commita2ec89d9d05229a5555d8302da83cb7e1314faa6 (patch) (unidiff)
tree6b4f4f89f9fc2ef483da27f6bb704a1633193944
parentbc20099519128f2640f57188c392039003a7a452 (diff)
downloadvmod-dbrw-a2ec89d9d05229a5555d8302da83cb7e1314faa6.tar.gz
vmod-dbrw-a2ec89d9d05229a5555d8302da83cb7e1314faa6.tar.bz2
Use vmod-dbrw (with a dash) as the canonical project name.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac10
-rw-r--r--doc/.gitignore30
-rw-r--r--doc/Makefile.am22
-rw-r--r--doc/vmod-dbrw.3402
-rw-r--r--doc/vmod-dbrw.texi (renamed from doc/vmod_dbrw.texi)32
-rw-r--r--doc/vmod_dbrw.3403
-rw-r--r--src/Makefile.am8
-rw-r--r--src/dbrw.h8
-rw-r--r--src/mysql.c8
-rw-r--r--src/pgsql.c8
-rw-r--r--src/sql.c8
-rw-r--r--src/vmod_dbrw.c8
13 files changed, 486 insertions, 469 deletions
diff --git a/Makefile.am b/Makefile.am
index 829c138..fa15223 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,18 +1,18 @@
1# This file is part of libvmod_dbrw 1# This file is part of vmod-dbrw
2# Copyright (C) 2013 Sergey Poznyakoff 2# Copyright (C) 2013 Sergey Poznyakoff
3# 3#
4# Libvmod_dbrw is free software; you can redistribute it and/or modify 4# Vmod-dbrw is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 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) 6# the Free Software Foundation; either version 3, or (at your option)
7# any later version. 7# any later version.
8# 8#
9# Libvmod_dbrw is distributed in the hope that it will be useful, 9# Vmod-dbrw is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details. 12# GNU General Public License for more details.
13# 13#
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15# along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16ACLOCAL_AMFLAGS = -I m4 16ACLOCAL_AMFLAGS = -I m4
17 17
18SUBDIRS = src doc #tests 18SUBDIRS = src doc #tests
diff --git a/configure.ac b/configure.ac
index d5a8767..a287eb3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,20 +1,20 @@
1# This file is part of libvmod_dbrw -*- autoconf -*- 1# This file is part of vmod-dbrw -*- autoconf -*-
2# Copyright (C) 2013 Sergey Poznyakoff 2# Copyright (C) 2013 Sergey Poznyakoff
3# 3#
4# Libvmod_dbrw is free software; you can redistribute it and/or modify 4# Vmod-dbrw is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 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) 6# the Free Software Foundation; either version 3, or (at your option)
7# any later version. 7# any later version.
8# 8#
9# Libvmod_dbrw is distributed in the hope that it will be useful, 9# Vmod-dbrw is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details. 12# GNU General Public License for more details.
13# 13#
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15# along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16AC_PREREQ(2.69) 16AC_PREREQ(2.69)
17AC_INIT([libvmod-dbrw], 0.99, [gray@gnu.org]) 17AC_INIT([vmod-dbrw], 0.99, [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_dbrw.vcc) 20AC_CONFIG_SRCDIR(src/vmod_dbrw.vcc)
diff --git a/doc/.gitignore b/doc/.gitignore
index 4e23977..ddb72ba 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1,19 +1,19 @@
1genfile.texi 1genfile.texi
2stamp-vti 2stamp-vti
3version.texi 3version.texi
4vmod_dbrw.info* 4vmod-dbrw.info*
5vmod_dbrw.aux 5vmod-dbrw.aux
6vmod_dbrw.cp 6vmod-dbrw.cp
7vmod_dbrw.cps 7vmod-dbrw.cps
8vmod_dbrw.fn 8vmod-dbrw.fn
9vmod_dbrw.kw 9vmod-dbrw.kw
10vmod_dbrw.ky 10vmod-dbrw.ky
11vmod_dbrw.log 11vmod-dbrw.log
12vmod_dbrw.op 12vmod-dbrw.op
13vmod_dbrw.pdf 13vmod-dbrw.pdf
14vmod_dbrw.pg 14vmod-dbrw.pg
15vmod_dbrw.toc 15vmod-dbrw.toc
16vmod_dbrw.tp 16vmod-dbrw.tp
17vmod_dbrw.vr 17vmod-dbrw.vr
18vmod_dbrw.t2p 18vmod-dbrw.t2p
19manual 19manual
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 9e03e8a..88cf24b 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,5 +1,21 @@
1dist_man_MANS = vmod_dbrw.3 1# This file is part of vmod-dbrw
2info_TEXINFOS=vmod_dbrw.texi 2# Copyright (C) 2013 Sergey Poznyakoff
3#
4# Vmod-dbrw 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-dbrw 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-dbrw. If not, see <http://www.gnu.org/licenses/>.
16
17dist_man_MANS = vmod-dbrw.3 vmod_dbrw.3
18info_TEXINFOS=vmod-dbrw.texi
3vmod_dbrw_TEXINFOS=fdl.texi 19vmod_dbrw_TEXINFOS=fdl.texi
4 20
5EXTRA_DIST = gendocs_template 21EXTRA_DIST = gendocs_template
@@ -19,7 +35,7 @@ manual:
19 MAKEINFO="$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS)" \ 35 MAKEINFO="$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS)" \
20 TEXI2DVI="$(TEXI2DVI) -t @finalout" \ 36 TEXI2DVI="$(TEXI2DVI) -t @finalout" \
21 TEXI2HTML="texi2html $(AM_MAKEINFOFLAGS)" \ 37 TEXI2HTML="texi2html $(AM_MAKEINFOFLAGS)" \
22 $(GENDOCS) --texi2html vmod_dbrw 'Vmod_dbrw manual' 38 $(GENDOCS) --texi2html $(PACKAGE) '$(PACKAGE_NAME) manual'
23 39
24 40
25manual.tar.bz2: manual 41manual.tar.bz2: manual
diff --git a/doc/vmod-dbrw.3 b/doc/vmod-dbrw.3
new file mode 100644
index 0000000..9c35772
--- a/dev/null
+++ b/doc/vmod-dbrw.3
@@ -0,0 +1,402 @@
1.\" This file is part of Vmod-dbrw -*- nroff -*-
2.\" Copyright (C) 2013 Sergey Poznyakoff
3.\"
4.\" Vmod-dbrw 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-dbrw 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-dbrw. If not, see <http://www.gnu.org/licenses/>.
16.TH VMOD_DBRW 1 "July 19, 2013" "VMOD_DBRW" "User Reference"
17.SH NAME
18vmod-dbrw \- Database-driven rewrite rules for Varnish Cache
19.SH SYNOPSIS
20.sp
21.nf
22import dbrw;
23
24sub vcl_init {
25 dbrw.config("\fIDBTYPE\fR", "\fIPARAMS\fR", "\fIQUERY\fR");
26}
27
28sub vcl_recv {
29 set req.http.\fIXHEADER\fR = dbrw.rewrite(\fIARGS\fR);
30 if (req.http.\fIXHEADER\fR) {
31 error(750, "Redirect");
32 }
33}
34
35sub vcl_error {
36 if (obj.status == 750) {
37 set obj.http.Location = req.http.\fIXHEADER\fR;
38 set obj.status = 301;
39 return (deliver);
40 }
41}
42.fi
43.SH DESCRIPTION
44.B Vmod-dbrw
45is a Varnish Cache module implementing database-driven rewrite procedures.
46Its intended use is for web sites that need an exceedingly big number
47of redirect and/or rewrite rules.
48.PP
49Upon startup, the \fBconfig\fR function should be called. This call
50configures the module and supplies it the information necessary for
51accessing the database and interpreting the data obtained from it.
52.PP
53Two database types are supported: \fBMySQL\fR or \fBPostgreSQL\fR.
54The first argument \fBconfig\fR instructs the module which type to
55use.
56.PP
57.B Vmod-dbrw
58does not impose any requirements on the structure of the database,
59therefore the connection arguments and access credentials may vary
60depending on the flavor of the database used. This information is
61supplied in the \fIPARAMS\fR argument, which is a list of parameter
62assignments separated with semicolons.
63.PP
64Once configured, the \fBrewrite\fR function can be called in the
65appropriate place of the Varnish configuration file. Its argument
66\fIARGS\fR is a list of variable assignments separated with
67semicolons, similarly to the \fIPARAMS\fR argument described above.
68Each assignment has the form \fINAME\fB=\fIVALUE\fR. When called
69the function expands the \fBSQL\fR query, supplied with the \fIQUERY\fR
70argument to the \fBconfig\fR call, by replacing each \fB$\fINAME\fR
71construct (a \fBvariable reference\fR) with the corresponding
72\fIVALUE\fR from its argument. Similarly to the shell syntax, the
73variable reference can be written as \fB${\fINAME\fB}\fR. This latter
74form can be used in contexts where the variable name is immediately
75followed by another letter, to prevent it from being counted as a part
76of the name.
77.PP
78The expanded query is then sent to the database server. The handling
79of the return value depends on the number of fields it contains.
80.SS Strict matches
81If the returned set consists of one or two columns, only the
82first tuple is used and the value of its first column is returned.
83The second column (if present) is ignored.
84.SS Regexp matches
85Otherwise, if the returned set consists of three or four columns, the
86columns are interpreted as follows: \fBresult\fR, \fBregexp\fR,
87\fBvalue\fR and optional \fBflags\fR. For each returned tuple, the
88\fBvalue\fR column undergoes variable expansion, using the same
89algorithm as when preparing the query, and the resulting string is
90matched with the \fBregexp\fR column, which is treated as an extended
91\fBPOSIX\fR regular expression. If the match occurs, the \fBresult\fR
92column is expanded by replacing \fBbackreferences\fR. Each occurrence
93of \fB$\fIDIGIT\fR (where \fIDIGIT\fR stands for a decimal digit from
94\fB0\fR through \fB9\fR) is replaced with the contents of the
95\fIDIGIT\fR's parenthesized subexpression in \fBregexp\fR. For
96compatibility with the traditional usage, the \fB\\\fIDIGIT\fR
97notation is also allowed. The resulting value is returned.
98.PP
99Optional \fBflags\fR column is a comma-separated list of flags that
100modify regular expression handling. The following flags are defined:
101.TP
102.BR NC " or " nocase
103Treat \fBregexp\fR as case-insensitive.
104.TP
105.B case
106Treat \fBregexp\fR as case-sensitive (default).
107.TP
108.BR QSA " or " qsappend
109Treat the resulting value as URL; append any query string from the
110original \fBvalue\fR to it.
111.TP
112.BR QSD " or " qsdiscard
113Treat the resulting value as URL; discard any query string attached to
114the original \fBvalue\fR.
115.TP
116\fBredirect=\fICODE\fR or \fBR=\fICODE\fR
117On success, set the \fBX\-VMOD\-DBRW\-Status\fR header to \fICODE\fR,
118which must be a valid HTTP status code.
119.PP
120If \fBregexp\fR or \fBvalue\fR is NULL, the tuple is handled as
121described in
122.BR "Strict matches" .
123.PP
124If \fBflags\fR is NULL, it is ignored.
125.SH FUNCTIONS
126.SS config
127.TP
128.B Prototype
129config(STRING \fIDBTYPE\fR, STRING \fIPARAMS\fR, STRING \fIQUERY\fR)
130.TP
131.B Return value
132VOID
133.TP
134.B Description
135This function configures the module and supplies the data necessary to
136connect and use the database.
137.TP
138.B Arguments
139.RS 4
140.TP
141.I DBTYPE
142Type of the database. Valid values are \fBmysql\fR (for \fBMySQL\fR)
143and \fBpgsql\fR (for \fBPostgreSQL\fR).
144.TP
145.I PARAMS
146Database connection parameters. This is a list of
147\fINAME\fB=\fIVALUE\fR assignments separated with semicolons. The
148\fIVALUE\fR can be any sequence of characters, excepting white space
149and semicolon. If any of these have to appear in it, they must either
150be escaped by prepending them with a backslash, or entire \fIVALUE\fR
151enclosed in a pair of (single or double) quotes. The following
152\fBescape sequences\fR are allowed for use in \fIVALUE\fR:
153.sp
154.nf
155.ta 8n 18n 42n
156.ul
157 Sequence ExpansionASCII
158 \fB\\\\\fR \fB\\\fR134
159 \fB\\"\fR \fB"\fR042
160 \fB\\a\fR audible bell 007
161 \fB\\b\fR backspace010
162 \fB\\f\fR form-feed014
163 \fB\\n\fR new line012
164 \fB\\r\fR charriage return015
165 \fB\\t\fR horizontal tabulation011
166 \fB\\v\fR vertical tabulation013
167.fi
168.sp
169Any other character following a backslash is output verbatim.
170.sp
171The valid parameters are:
172.RS 8
173.TP
174\fBdebug\fR=\fIN\fR
175Set debugging level. \fIN\fR is a decimal number.
176.TP
177\fBserver\fR=\fIHOST\fR
178Name or IP address of the database server to connect to. If not
179defined, localhost (\fB127.0.0.1\fR) is assumed. For \fBMySQL\fR
180databases, if \fIHOST\fR begins with a slash (\fB/\fR), its value is
181taken to be the full pathname of the local UNIX socket to connect to.
182.TP
183\fBport\fR=\fINUM\fR
184Port number on the \fBserver\fR to connect to. Default is \fB3306\fR
185for \fBMySQL\fR and \fB5432\fR for \fBPostgres\fR.
186.TP
187\fBdatabase=\fINAME\fR
188The database name.
189.TP
190\fBconfig\fR=\fIFILE\fR
191(\fBMySQL\fR-specific) Read credentials from the \fBMySQL\fR options
192file \fIFILE\fR.
193.TP
194\fBgroup\fR=\fINAME\fR
195(\fBMySQL\fR-specific) Read credentials from section \fINAME\fR of the
196options file supplied with the \fBconfig\fR parameter. Default
197section name is \fBclient\fR.
198.TP
199\fBcacert\fR=\fIFILE\fR
200Use secure connection to the database server via SSL. The \fIFILE\fR
201is a full pathname to the certificate authority file.
202.TP
203\fBoptions\fR=\fISTRING\fR
204(\fBPostgres\fR-specific) Connection options.
205.TP
206\fBuser\fR=\fINAME\fR
207Database user name.
208.TP
209\fBpassword\fR=\fISTRING\fR
210Password to access the database.
211.RE
212.TP
213.I QUERY
214\fBSQL\fR query to use. It can contain variable references in the
215form \fB$\fINAME\fR or \fB${\fINAME\fB|\fR, which will be replaced
216prior to the execution with the actual value of the \fINAME\fR
217argument to the function \fBrewrite\fR.
218.RE
219.SS rewrite
220.TP
221.B Prototype
222rewrite(STRING \fIARGS\fR)
223.TP
224.B Return value
225STRING
226.TP
227.B Description
228Rewrites the argument according to the database. See the section
229\fBDESCRIPTION\fR for a detailed discussion.
230.SH EXAMPLES
231The examples in this section assume \fBMySQL\fR databases. Any
232details not related to \fBvmod-dbrw\fR are omitted. The \fBsub
233vcl_error\fR is responsible for actual returning the 301 or 302
234error. If not shown it is the same as in section \fBSYNOPSIS\fR.
235.SS Redirects
236.PP
237This example shows how to implement apache-style permanent redirects
238in Varnish.
239.PP
240The following table is used to keep the redirection data:
241.sp
242.nf
243.in +2
244CREATE TABLE redirects (
245 host varchar(255) NOT NULL DEFAULT '',
246 url varchar(255) NOT NULL DEFAULT '',
247 dest varchar(255) DEFAULT NULL,
248 PRIMARY KEY (host,url)
249);
250.in
251.fi
252.PP
253VCL code:
254.sp
255.nf
256.in +2
257sub vcl_init {
258 dbrw.config("mysql", "database=dbname;user=varnish",
259 {"SELECT dest
260 FROM redirects
261 WHERE host='$host'
262 AND url='$url'"});
263}
264
265sub vcl_recv {
266 set req.http.X-Redirect-To =
267 dbrw.rewrite("host=" + req.http.Host + ";" +
268 "url=" + req.url);
269 if (req.http.X-Redirect-To != "") {
270 error(750, "Redirect");
271 }
272}
273.in
274.fi
275.PP
276Notice the use of concatenation to build the argument to
277\fBdbrw.rewrite\fR.
278.SS Rewrites.
279.PP
280The database structure is as follows:
281.sp
282.nf
283.in +2
284CREATE TABLE rewrite (
285 host varchar(255) NOT NULL DEFAULT '',
286 url varchar(255) NOT NULL DEFAULT '',
287 dest varchar(255) DEFAULT NULL,
288 value varchar(255) DEFAULT NULL,
289 pattern varchar(255) DEFAULT NULL,
290 flags char(64) DEFAULT NULL,
291 KEY source (host,url)
292)
293.in
294.fi
295.PP
296VCL code:
297.sp
298.nf
299.in +2
300import std; # The std module is used by \fBvcl_error\fR below
301import dbrw;
302
303sub vcl_init {
304 # It is supposed that the url column contains an SQL-style
305 # wildcard pattern.
306 dbrw.config("mysql", "database=varnish;user=varnish;debug=10",
307 {"SELECT dest,pattern,value,flags FROM rewrite
308 WHERE host='$host' and '$url' like url"});
309}
310
311sub vcl_recv {
312 set req.http.X-Redirect-To =
313 dbrw.rewrite("host=" + req.http.Host + ";" +
314 "url=" + req.url);
315 if (req.http.X-Redirect-To != "") {
316 error(750, "Redirect");
317 }
318}
319.in
320.fi
321.PP
322The \fBvcl_error\fR function uses the \fBX\-VMOD\-DBRW\-Status\fR
323header, which may be set by \fBredirect=\fR flag in the
324\fBflags\fR column. Its value is converted to integer using the
325\fBinteger\fR function from the \fBstd\fR module. If the header is
326not set, permanent redirect is assumed:
327.sp
328.nf
329.in +2
330sub vcl_error {
331 if (obj.status == 750) {
332 set obj.http.Location = req.http.X-Redirect-To;
333 set obj.status = std.integer(req.http.X-VMOD-DBRW-Status, 301);
334 return (deliver);
335 }
336}
337.in
338.fi
339.SS Use of vmod-dbrw and vmod-redirect
340.PP
341Using the \fBvmod-redirect\fR module
342.BR ( https://www.varnish-cache.org/vmod/redirect )
343you can get rid of the \fBvcl_error\fR subroutine.
344.sp
345.nf
346.in +2
347import std;
348import dbrw;
349import redirect;
350
351sub vcl_recv {
352 set req.http.X-Redirect-To =
353 dbrw.rewrite("host=" + req.http.Host + ";" +
354 "url=" + req.url);
355 if (req.http.X-Redirect-To != "") {
356 error(redirect.location(
357 std.integer(req.http.X-VMOD-DBRW-Status, 301),
358 req.http.X-Redirect-To), "Redirection");
359 }
360}
361.in
362.fi
363.SH "SEE ALSO"
364.BR vcl (7),
365.BR varnishd (1).
366.PP
367The full documentation for
368.B vmod-dbrw
369is maintained as a Texinfo
370manual. If the
371.B info
372program and
373.B vmod-dbrw
374module are properly installed at your site, the command
375.sp
376.nf
377.in +4
378.B info vmod-dbrw
379.in
380.fi
381.PP
382should give you access to the complete manual.
383.SH AUTHORS
384Sergey Poznyakoff
385.SH "BUG REPORTS"
386Report bugs to <gray@gnu.org>.
387.SH COPYRIGHT
388Copyright \(co 2013 Sergey Poznyakoff
389.br
390.na
391License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
392.br
393.ad
394This is free software: you are free to change and redistribute it.
395There is NO WARRANTY, to the extent permitted by law.
396.\" Local variables:
397.\" eval: (add-hook 'write-file-hooks 'time-stamp)
398.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.-]* [0-9] \""
399.\" time-stamp-format: "%:B %:d, %:y"
400.\" time-stamp-end: "\""
401.\" time-stamp-line-limit: 20
402.\" end:
diff --git a/doc/vmod_dbrw.texi b/doc/vmod-dbrw.texi
index 6ec2431..de83723 100644
--- a/doc/vmod_dbrw.texi
+++ b/doc/vmod-dbrw.texi
@@ -1,8 +1,8 @@
1\input texinfo @c -*-texinfo-*- 1\input texinfo @c -*-texinfo-*-
2@smallbook 2@smallbook
3@c %**start of header 3@c %**start of header
4@setfilename vmod_dbrw.info 4@setfilename vmod-dbrw.info
5@settitle Vmod_dbrw User Manual 5@settitle vmod-dbrw User Manual
6@c %**end of header 6@c %**end of header
7@setchapternewpage odd 7@setchapternewpage odd
8 8
@@ -21,7 +21,7 @@
21@ifinfo 21@ifinfo
22@dircategory Varnish Cache Modules 22@dircategory Varnish Cache Modules
23@direntry 23@direntry
24* vmod_dbrw: (vmod_dbrw). Database-driven rewrite rules. 24* vmod-dbrw: (vmod-dbrw). Database-driven rewrite rules.
25@end direntry 25@end direntry
26@end ifinfo 26@end ifinfo
27 27
@@ -41,7 +41,7 @@ Documentation License''.
41@end copying 41@end copying
42 42
43@titlepage 43@titlepage
44@title Vmod_Dbrw User Manual 44@title Vmod-Dbrw User Manual
45@subtitle version @value{VERSION}, @value{UPDATED} 45@subtitle version @value{VERSION}, @value{UPDATED}
46@author Sergey Poznyakoff. 46@author Sergey Poznyakoff.
47@page 47@page
@@ -58,13 +58,13 @@ Documentation License''.
58 58
59@ifnottex 59@ifnottex
60@node Top 60@node Top
61@top Vmod_dbrw 61@top vmod-dbrw
62This edition of the @cite{Vmod_dbrw User Manual}, last updated @value{UPDATED}, 62This edition of the @cite{vmod-dbrw User Manual}, last updated @value{UPDATED},
63documents @command{vmod_dbrw} Version @value{VERSION}. 63documents @command{vmod-dbrw} Version @value{VERSION}.
64@end ifnottex 64@end ifnottex
65 65
66@menu 66@menu
67* Intro:: What is Vmod_dbrw. 67* Intro:: What is vmod-dbrw.
68* Overview:: How it works. 68* Overview:: How it works.
69* Configuration:: 69* Configuration::
70* Query:: How to Write a Query. 70* Query:: How to Write a Query.
@@ -85,17 +85,17 @@ Appendices
85@end menu 85@end menu
86 86
87@node Intro 87@node Intro
88@chapter Introduction to Vmod_dbrw 88@chapter Introduction to vmod-dbrw
89@cindex Varnish 89@cindex Varnish
90@cindex rewrite rules 90@cindex rewrite rules
91@command{Vmod_dbrw} is a module for 91@command{Vmod-dbrw} is a module for
92@command{Varnish Cache}@footnote{@url{https://www.varnish-cache.org}} 92@command{Varnish Cache}@footnote{@url{https://www.varnish-cache.org}}
93which implements database-driven rewrite rules. These rules may be 93which implements database-driven rewrite rules. These rules may be
94similar to @code{RewriteRule} directives implemented by 94similar to @code{RewriteRule} directives implemented by
95@command{mod_rewrite}@footnote{@url{http://httpd.apache.org/docs/current/rewrite/}} 95@command{mod_rewrite}@footnote{@url{http://httpd.apache.org/docs/current/rewrite/}}
96module in @command{Apache} or to @code{Redirect} directives of its 96module in @command{Apache} or to @code{Redirect} directives of its
97@command{mod_alias} module. What distinguishes the 97@command{mod_alias} module. What distinguishes the
98@command{vmod_dbrw} rules from these, is that they are handled by 98@command{vmod-dbrw} rules from these, is that they are handled by
99@command{Varnish}, before the request reaches the httpd server, and 99@command{Varnish}, before the request reaches the httpd server, and
100that they are stored in an SQL database, which makes them easily 100that they are stored in an SQL database, which makes them easily
101manageable. 101manageable.
@@ -109,7 +109,7 @@ of this module is to facilitate deploying and handling them.
109@cindex database engines 109@cindex database engines
110@cindex supported databases 110@cindex supported databases
111The rewrite rules are stored in a MySQL or PostgreSQL database. The 111The rewrite rules are stored in a MySQL or PostgreSQL database. The
112@command{vmod_dbrw} module does not impose any restrictions on its 112@command{vmod-dbrw} module does not impose any restrictions on its
113schema. It only needs to know the SQL query which is to be used to 113schema. It only needs to know the SQL query which is to be used to
114retrieve data. This query is supplied to the module, along with the 114retrieve data. This query is supplied to the module, along with the
115credentials for accessing the database, by calling the @code{config} 115credentials for accessing the database, by calling the @code{config}
@@ -336,7 +336,7 @@ with the actual value of the @var{name} argument to the function
336@end table 336@end table
337@end deftypefn 337@end deftypefn
338 338
339The example below configures @command{vmod_dbrw} to use MySQL database 339The example below configures @command{vmod-dbrw} to use MySQL database
340@samp{rewrite}, with the user name @samp{varnish} and password @var{guessme}. 340@samp{rewrite}, with the user name @samp{varnish} and password @var{guessme}.
341 341
342@example 342@example
@@ -362,7 +362,7 @@ database schema and on the kind of matching required. To ensure the
362best performance of the module it is important to design the database 362best performance of the module it is important to design the database
363and the query so that the database look up be as fast as possible. 363and the query so that the database look up be as fast as possible.
364 364
365Suppose that you plan to use @command{vmod_dbrw} to implement 365Suppose that you plan to use @command{vmod-dbrw} to implement
366redirection rules based on strict matching (@pxref{strict matching}). 366redirection rules based on strict matching (@pxref{strict matching}).
367 367
368The simplest database structure for this purpose (assuming MySQL) will be: 368The simplest database structure for this purpose (assuming MySQL) will be:
@@ -410,7 +410,7 @@ actual host and URL parts of the incoming request.
410 410
411Handling regular expression matches is a bit trickier. Your query 411Handling regular expression matches is a bit trickier. Your query
412should first return the rows that could match the request. Then the 412should first return the rows that could match the request. Then the
413@command{vmod_dbrw} engine will do the rest, by iterating over them 413@command{vmod-dbrw} engine will do the rest, by iterating over them
414and finding the one that actually does. It will iterate over the rows 414and finding the one that actually does. It will iterate over the rows
415in the order they were returned by the database server, so it might be 415in the order they were returned by the database server, so it might be
416necessary to sort them by some criterion beforehand. 416necessary to sort them by some criterion beforehand.
@@ -626,7 +626,7 @@ information needed is:
626@item Conditions under which the bug appears. 626@item Conditions under which the bug appears.
627@item It is often helpful to send the contents of @file{config.log} 627@item It is often helpful to send the contents of @file{config.log}
628file along with your bug report. This file is created after running 628file along with your bug report. This file is created after running
629@command{./configure} in @command{vmod_dbrw} source root directory. 629@command{./configure} in @command{vmod-dbrw} source root directory.
630@end itemize 630@end itemize
631 631
632@node Copying This Manual 632@node Copying This Manual
diff --git a/doc/vmod_dbrw.3 b/doc/vmod_dbrw.3
index 777547e..7aa3d08 100644
--- a/doc/vmod_dbrw.3
+++ b/doc/vmod_dbrw.3
@@ -1,402 +1 @@
1.\" This file is part of libvmod_dbrw -*- nroff -*- .so man3/vmod-dbrw.3
2.\" Copyright (C) 2013 Sergey Poznyakoff
3.\"
4.\" Libvmod_dbrw 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.\" Libvmod_dbrw 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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>.
16.TH VMOD_DBRW 1 "July 19, 2013" "VMOD_DBRW" "User Reference"
17.SH NAME
18vmod_dbrw \- Database-driven rewrite rules for Varnish Cache
19.SH SYNOPSIS
20.sp
21.nf
22import dbrw;
23
24sub vcl_init {
25 dbrw.config("\fIDBTYPE\fR", "\fIPARAMS\fR", "\fIQUERY\fR");
26}
27
28sub vcl_recv {
29 set req.http.\fIXHEADER\fR = dbrw.rewrite(\fIARGS\fR);
30 if (req.http.\fIXHEADER\fR) {
31 error(750, "Redirect");
32 }
33}
34
35sub vcl_error {
36 if (obj.status == 750) {
37 set obj.http.Location = req.http.\fIXHEADER\fR;
38 set obj.status = 301;
39 return (deliver);
40 }
41}
42.fi
43.SH DESCRIPTION
44.B Vmod-dbrw
45is a Varnish Cache module implementing database-driven rewrite procedures.
46Its intended use is for web sites that need an exceedingly big number
47of redirect and/or rewrite rules.
48.PP
49Upon startup, the \fBconfig\fR function should be called. This call
50configures the module and supplies it the information necessary for
51accessing the database and interpreting the data obtained from it.
52.PP
53Two database types are supported: \fBMySQL\fR or \fBPostgreSQL\fR.
54The first argument \fBconfig\fR instructs the module which type to
55use.
56.PP
57.B Vmod-dbrw
58does not impose any requirements on the structure of the database,
59therefore the connection arguments and access credentials may vary
60depending on the flavor of the database used. This information is
61supplied in the \fIPARAMS\fR argument, which is a list of parameter
62assignments separated with semicolons.
63.PP
64Once configured, the \fBrewrite\fR function can be called in the
65appropriate place of the Varnish configuration file. Its argument
66\fIARGS\fR is a list of variable assignments separated with
67semicolons, similarly to the \fIPARAMS\fR argument described above.
68Each assignment has the form \fINAME\fB=\fIVALUE\fR. When called
69the function expands the \fBSQL\fR query, supplied with the \fIQUERY\fR
70argument to the \fBconfig\fR call, by replacing each \fB$\fINAME\fR
71construct (a \fBvariable reference\fR) with the corresponding
72\fIVALUE\fR from its argument. Similarly to the shell syntax, the
73variable reference can be written as \fB${\fINAME\fB}\fR. This latter
74form can be used in contexts where the variable name is immediately
75followed by another letter, to prevent it from being counted as a part
76of the name.
77.PP
78The expanded query is then sent to the database server. The handling
79of the return value depends on the number of fields it contains.
80.SS Strict matches
81If the returned set consists of one or two columns, only the
82first tuple is used and the value of its first column is returned.
83The second column (if present) is ignored.
84.SS Regexp matches
85Otherwise, if the returned set consists of three or four columns, the
86columns are interpreted as follows: \fBresult\fR, \fBregexp\fR,
87\fBvalue\fR and optional \fBflags\fR. For each returned tuple, the
88\fBvalue\fR column undergoes variable expansion, using the same
89algorithm as when preparing the query, and the resulting string is
90matched with the \fBregexp\fR column, which is treated as an extended
91\fBPOSIX\fR regular expression. If the match occurs, the \fBresult\fR
92column is expanded by replacing \fBbackreferences\fR. Each occurrence
93of \fB$\fIDIGIT\fR (where \fIDIGIT\fR stands for a decimal digit from
94\fB0\fR through \fB9\fR) is replaced with the contents of the
95\fIDIGIT\fR's parenthesized subexpression in \fBregexp\fR. For
96compatibility with the traditional usage, the \fB\\\fIDIGIT\fR
97notation is also allowed. The resulting value is returned.
98.PP
99Optional \fBflags\fR column is a comma-separated list of flags that
100modify regular expression handling. The following flags are defined:
101.TP
102.BR NC " or " nocase
103Treat \fBregexp\fR as case-insensitive.
104.TP
105.B case
106Treat \fBregexp\fR as case-sensitive (default).
107.TP
108.BR QSA " or " qsappend
109Treat the resulting value as URL; append any query string from the
110original \fBvalue\fR to it.
111.TP
112.BR QSD " or " qsdiscard
113Treat the resulting value as URL; discard any query string attached to
114the original \fBvalue\fR.
115.TP
116\fBredirect=\fICODE\fR or \fBR=\fICODE\fR
117On success, set the \fBX\-VMOD\-DBRW\-Status\fR header to \fICODE\fR,
118which must be a valid HTTP status code.
119.PP
120If \fBregexp\fR or \fBvalue\fR is NULL, the tuple is handled as
121described in
122.BR "Strict matches" .
123.PP
124If \fBflags\fR is NULL, it is ignored.
125.SH FUNCTIONS
126.SS config
127.TP
128.B Prototype
129config(STRING \fIDBTYPE\fR, STRING \fIPARAMS\fR, STRING \fIQUERY\fR)
130.TP
131.B Return value
132VOID
133.TP
134.B Description
135This function configures the module and supplies the data necessary to
136connect and use the database.
137.TP
138.B Arguments
139.RS 4
140.TP
141.I DBTYPE
142Type of the database. Valid values are \fBmysql\fR (for \fBMySQL\fR)
143and \fBpgsql\fR (for \fBPostgreSQL\fR).
144.TP
145.I PARAMS
146Database connection parameters. This is a list of
147\fINAME\fB=\fIVALUE\fR assignments separated with semicolons. The
148\fIVALUE\fR can be any sequence of characters, excepting white space
149and semicolon. If any of these have to appear in it, they must either
150be escaped by prepending them with a backslash, or entire \fIVALUE\fR
151enclosed in a pair of (single or double) quotes. The following
152\fBescape sequences\fR are allowed for use in \fIVALUE\fR:
153.sp
154.nf
155.ta 8n 18n 42n
156.ul
157 Sequence ExpansionASCII
158 \fB\\\\\fR \fB\\\fR134
159 \fB\\"\fR \fB"\fR042
160 \fB\\a\fR audible bell 007
161 \fB\\b\fR backspace010
162 \fB\\f\fR form-feed014
163 \fB\\n\fR new line012
164 \fB\\r\fR charriage return015
165 \fB\\t\fR horizontal tabulation011
166 \fB\\v\fR vertical tabulation013
167.fi
168.sp
169Any other character following a backslash is output verbatim.
170.sp
171The valid parameters are:
172.RS 8
173.TP
174\fBdebug\fR=\fIN\fR
175Set debugging level. \fIN\fR is a decimal number.
176.TP
177\fBserver\fR=\fIHOST\fR
178Name or IP address of the database server to connect to. If not
179defined, localhost (\fB127.0.0.1\fR) is assumed. For \fBMySQL\fR
180databases, if \fIHOST\fR begins with a slash (\fB/\fR), its value is
181taken to be the full pathname of the local UNIX socket to connect to.
182.TP
183\fBport\fR=\fINUM\fR
184Port number on the \fBserver\fR to connect to. Default is \fB3306\fR
185for \fBMySQL\fR and \fB5432\fR for \fBPostgres\fR.
186.TP
187\fBdatabase=\fINAME\fR
188The database name.
189.TP
190\fBconfig\fR=\fIFILE\fR
191(\fBMySQL\fR-specific) Read credentials from the \fBMySQL\fR options
192file \fIFILE\fR.
193.TP
194\fBgroup\fR=\fINAME\fR
195(\fBMySQL\fR-specific) Read credentials from section \fINAME\fR of the
196options file supplied with the \fBconfig\fR parameter. Default
197section name is \fBclient\fR.
198.TP
199\fBcacert\fR=\fIFILE\fR
200Use secure connection to the database server via SSL. The \fIFILE\fR
201is a full pathname to the certificate authority file.
202.TP
203\fBoptions\fR=\fISTRING\fR
204(\fBPostgres\fR-specific) Connection options.
205.TP
206\fBuser\fR=\fINAME\fR
207Database user name.
208.TP
209\fBpassword\fR=\fISTRING\fR
210Password to access the database.
211.RE
212.TP
213.I QUERY
214\fBSQL\fR query to use. It can contain variable references in the
215form \fB$\fINAME\fR or \fB${\fINAME\fB|\fR, which will be replaced
216prior to the execution with the actual value of the \fINAME\fR
217argument to the function \fBrewrite\fR.
218.RE
219.SS rewrite
220.TP
221.B Prototype
222rewrite(STRING \fIARGS\fR)
223.TP
224.B Return value
225STRING
226.TP
227.B Description
228Rewrites the argument according to the database. See the section
229\fBDESCRIPTION\fR for a detailed discussion.
230.SH EXAMPLES
231The examples in this section assume \fBMySQL\fR databases. Any
232details not related to \fBvmod_dbrw\fR are omitted. The \fBsub
233vcl_error\fR is responsible for actual returning the 301 or 302
234error. If not shown it is the same as in section \fBSYNOPSIS\fR.
235.SS Redirects
236.PP
237This example shows how to implement apache-style permanent redirects
238in Varnish.
239.PP
240The following table is used to keep the redirection data:
241.sp
242.nf
243.in +2
244CREATE TABLE redirects (
245 host varchar(255) NOT NULL DEFAULT '',
246 url varchar(255) NOT NULL DEFAULT '',
247 dest varchar(255) DEFAULT NULL,
248 PRIMARY KEY (host,url)
249);
250.in
251.fi
252.PP
253VCL code:
254.sp
255.nf
256.in +2
257sub vcl_init {
258 dbrw.config("mysql", "database=dbname;user=varnish",
259 {"SELECT dest
260 FROM redirects
261 WHERE host='$host'
262 AND url='$url'"});
263}
264
265sub vcl_recv {
266 set req.http.X-Redirect-To =
267 dbrw.rewrite("host=" + req.http.Host + ";" +
268 "url=" + req.url);
269 if (req.http.X-Redirect-To != "") {
270 error(750, "Redirect");
271 }
272}
273.in
274.fi
275.PP
276Notice the use of concatenation to build the argument to
277\fBdbrw.rewrite\fR.
278.SS Rewrites.
279.PP
280The database structure is as follows:
281.sp
282.nf
283.in +2
284CREATE TABLE rewrite (
285 host varchar(255) NOT NULL DEFAULT '',
286 url varchar(255) NOT NULL DEFAULT '',
287 dest varchar(255) DEFAULT NULL,
288 value varchar(255) DEFAULT NULL,
289 pattern varchar(255) DEFAULT NULL,
290 flags char(64) DEFAULT NULL,
291 KEY source (host,url)
292)
293.in
294.fi
295.PP
296VCL code:
297.sp
298.nf
299.in +2
300import std; # The std module is used by \fBvcl_error\fR below
301import dbrw;
302
303sub vcl_init {
304 # It is supposed that the url column contains an SQL-style
305 # wildcard pattern.
306 dbrw.config("mysql", "database=varnish;user=varnish;debug=10",
307 {"SELECT dest,pattern,value,flags FROM rewrite
308 WHERE host='$host' and '$url' like url"});
309}
310
311sub vcl_recv {
312 set req.http.X-Redirect-To =
313 dbrw.rewrite("host=" + req.http.Host + ";" +
314 "url=" + req.url);
315 if (req.http.X-Redirect-To != "") {
316 error(750, "Redirect");
317 }
318}
319.in
320.fi
321.PP
322The \fBvcl_error\fR function uses the \fBX\-VMOD\-DBRW\-Status\fR
323header, which may be set by \fBredirect=\fR flag in the
324\fBflags\fR column. Its value is converted to integer using the
325\fBinteger\fR function from the \fBstd\fR module. If the header is
326not set, permanent redirect is assumed:
327.sp
328.nf
329.in +2
330sub vcl_error {
331 if (obj.status == 750) {
332 set obj.http.Location = req.http.X-Redirect-To;
333 set obj.status = std.integer(req.http.X-VMOD-DBRW-Status, 301);
334 return (deliver);
335 }
336}
337.in
338.fi
339.SS Use of vmod_dbrw and vmod_redirect
340.PP
341Using the \fBvmod_redirect\fR module
342.BR ( https://www.varnish-cache.org/vmod/redirect )
343you can get rid of the \fBvcl_error\fR subroutine.
344.sp
345.nf
346.in +2
347import std;
348import dbrw;
349import redirect;
350
351sub vcl_recv {
352 set req.http.X-Redirect-To =
353 dbrw.rewrite("host=" + req.http.Host + ";" +
354 "url=" + req.url);
355 if (req.http.X-Redirect-To != "") {
356 error(redirect.location(
357 std.integer(req.http.X-VMOD-DBRW-Status, 301),
358 req.http.X-Redirect-To), "Redirection");
359 }
360}
361.in
362.fi
363.SH "SEE ALSO"
364.BR vcl (7),
365.BR varnishd (1).
366.PP
367The full documentation for
368.B vmod_dbrw
369is maintained as a Texinfo
370manual. If the
371.B info
372program and
373.B vmod_dbrw
374module are properly installed at your site, the command
375.sp
376.nf
377.in +4
378.B info vmod_dbrw
379.in
380.fi
381.PP
382should give you access to the complete manual.
383.SH AUTHORS
384Sergey Poznyakoff
385.SH "BUG REPORTS"
386Report bugs to <gray@gnu.org>.
387.SH COPYRIGHT
388Copyright \(co 2013 Sergey Poznyakoff
389.br
390.na
391License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
392.br
393.ad
394This is free software: you are free to change and redistribute it.
395There is NO WARRANTY, to the extent permitted by law.
396.\" Local variables:
397.\" eval: (add-hook 'write-file-hooks 'time-stamp)
398.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.-]* [0-9] \""
399.\" time-stamp-format: "%:B %:d, %:y"
400.\" time-stamp-end: "\""
401.\" time-stamp-line-limit: 20
402.\" end:
diff --git a/src/Makefile.am b/src/Makefile.am
index 37b9ce6..ed7d376 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,18 +1,18 @@
1# This file is part of libvmod_dbrw 1# This file is part of vmod-dbrw
2# Copyright (C) 2013 Sergey Poznyakoff 2# Copyright (C) 2013 Sergey Poznyakoff
3# 3#
4# Libvmod_dbrw is free software; you can redistribute it and/or modify 4# Vmod-dbrw is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 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) 6# the Free Software Foundation; either version 3, or (at your option)
7# any later version. 7# any later version.
8# 8#
9# Libvmod_dbrw is distributed in the hope that it will be useful, 9# Vmod-dbrw is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details. 12# GNU General Public License for more details.
13# 13#
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15# along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16 16
17AM_CPPFLAGS = -I$(VARNISHSRC)/include -I$(VARNISHSRC) 17AM_CPPFLAGS = -I$(VARNISHSRC)/include -I$(VARNISHSRC)
18 18
diff --git a/src/dbrw.h b/src/dbrw.h
index 7fe9faf..05645d4 100644
--- a/src/dbrw.h
+++ b/src/dbrw.h
@@ -1,18 +1,18 @@
1/* This file is part of libvmod_dbrw 1/* This file is part of vmod-dbrw
2 Copyright (C) 2013 Sergey Poznyakoff 2 Copyright (C) 2013 Sergey Poznyakoff
3 3
4 Libvmod_dbrw is free software; you can redistribute it and/or modify 4 Vmod-dbrw is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 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) 6 the Free Software Foundation; either version 3, or (at your option)
7 any later version. 7 any later version.
8 8
9 Libvmod_dbrw is distributed in the hope that it will be useful, 9 Vmod-dbrw is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <config.h> 17#include <config.h>
18#include <stdlib.h> 18#include <stdlib.h>
diff --git a/src/mysql.c b/src/mysql.c
index 9805887..c777ac6 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -1,18 +1,18 @@
1/* This file is part of libvmod_dbrw 1/* This file is part of vmod-dbrw
2 Copyright (C) 2013 Sergey Poznyakoff 2 Copyright (C) 2013 Sergey Poznyakoff
3 3
4 Libvmod_dbrw is free software; you can redistribute it and/or modify 4 Vmod-dbrw is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 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) 6 the Free Software Foundation; either version 3, or (at your option)
7 any later version. 7 any later version.
8 8
9 Libvmod_dbrw is distributed in the hope that it will be useful, 9 Vmod-dbrw is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "dbrw.h" 17#include "dbrw.h"
18#include <mysql/mysql.h> 18#include <mysql/mysql.h>
diff --git a/src/pgsql.c b/src/pgsql.c
index 3599b5f..4e3642e 100644
--- a/src/pgsql.c
+++ b/src/pgsql.c
@@ -1,18 +1,18 @@
1/* This file is part of libvmod_dbrw 1/* This file is part of vmod-dbrw
2 Copyright (C) 2013 Sergey Poznyakoff 2 Copyright (C) 2013 Sergey Poznyakoff
3 3
4 Libvmod_dbrw is free software; you can redistribute it and/or modify 4 Vmod-dbrw is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 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) 6 the Free Software Foundation; either version 3, or (at your option)
7 any later version. 7 any later version.
8 8
9 Libvmod_dbrw is distributed in the hope that it will be useful, 9 Vmod-dbrw is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "dbrw.h" 17#include "dbrw.h"
18#include <string.h> 18#include <string.h>
diff --git a/src/sql.c b/src/sql.c
index c3db24c..3a6cbe4 100644
--- a/src/sql.c
+++ b/src/sql.c
@@ -1,18 +1,18 @@
1/* This file is part of libvmod_dbrw 1/* This file is part of vmod-dbrw
2 Copyright (C) 2013 Sergey Poznyakoff 2 Copyright (C) 2013 Sergey Poznyakoff
3 3
4 Libvmod_dbrw is free software; you can redistribute it and/or modify 4 Vmod-dbrw is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 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) 6 the Free Software Foundation; either version 3, or (at your option)
7 any later version. 7 any later version.
8 8
9 Libvmod_dbrw is distributed in the hope that it will be useful, 9 Vmod-dbrw is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "dbrw.h" 17#include "dbrw.h"
18#include <assert.h> 18#include <assert.h>
diff --git a/src/vmod_dbrw.c b/src/vmod_dbrw.c
index 4e7b0e2..4085157 100644
--- a/src/vmod_dbrw.c
+++ b/src/vmod_dbrw.c
@@ -1,18 +1,18 @@
1/* This file is part of libvmod_dbrw 1/* This file is part of vmod-dbrw
2 Copyright (C) 2013 Sergey Poznyakoff 2 Copyright (C) 2013 Sergey Poznyakoff
3 3
4 Libvmod_dbrw is free software; you can redistribute it and/or modify 4 Vmod-dbrw is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 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) 6 the Free Software Foundation; either version 3, or (at your option)
7 any later version. 7 any later version.
8 8
9 Libvmod_dbrw is distributed in the hope that it will be useful, 9 Vmod-dbrw is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
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 libvmod_dbrw. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "dbrw.h" 17#include "dbrw.h"
18#include <stdarg.h> 18#include <stdarg.h>

Return to:

Send suggestions and report system problems to the System administrator.