summaryrefslogtreecommitdiffabout
path: root/doc/vmod-dbrw.texi
authorSergey Poznyakoff <gray@gnu.org>2018-12-08 10:03:40 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-12-08 10:03:40 (GMT)
commit602f4d93070ac0e762e0cbe3ef72ba792f9c4811 (patch) (side-by-side diff)
tree8047168c6b23de38973b494b6ec794a81faf3576 /doc/vmod-dbrw.texi
parent2a684f1cdd7723c2ded277ea2c7e66227b6f3ae1 (diff)
downloadvmod-dbrw-602f4d93070ac0e762e0cbe3ef72ba792f9c4811.tar.gz
vmod-dbrw-602f4d93070ac0e762e0cbe3ef72ba792f9c4811.tar.bz2
Implement the $(urlprefixes) built-in function.
* NEWS: Update. * README: Update. * configure.ac: Version 2.2.91 * doc/vmod-dbrw.3: Document the use of $(urlprefixes) built-in * doc/vmod-dbrw.texi: Likewise. * src/vmod_dbrw.c (parse_flags): Make sure status string is null-terminated. (do_rewrite): Expand built-in functions in $(). Support urlprefixes. On debug_level=100, produce detailed trace of expansions. * src/wordsplit.c: Pull from grecs commit 9097d529. * src/wordsplit.h: Likewise. * tests/initdb.at (rewrite): Change the url column. * tests/rewrite01.at: Use $(urlprefixes) in the SQL templates. * tests/rewrite02.at: Likewise. * tests/rewrite03.at: Likewise. * tests/rewrite04.at: Likewise. * tests/rewrite05.at: Likewise. * tests/rewrite06.at: Likewise.
Diffstat (limited to 'doc/vmod-dbrw.texi') (more/less context) (ignore whitespace changes)
-rw-r--r--doc/vmod-dbrw.texi16
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/vmod-dbrw.texi b/doc/vmod-dbrw.texi
index 40fc84d..31b15d1 100644
--- a/doc/vmod-dbrw.texi
+++ b/doc/vmod-dbrw.texi
@@ -496,19 +496,29 @@ ORDER BY weight
@end example
@noindent
-Furthermore, the @code{url} column can contain a SQL wildcard pattern,
-in which case the query will look like:
+Furthermore, the @code{url} column can contain a path prefix,
+which can be matched using the @code{IN} conditional:
@example
@group
SELECT dest,pattern,value,flags
FROM rewrite
WHERE host='$host'
-AND '$url' like $url
+AND url IN ($(urlprefixes $url))
ORDER BY weight
@end group
@end example
+Notice the use of the @samp{$(urlprefixes $url)}. This invokes the built-in
+@dfn{function} @code{urlprefixes}, which expands to comma-separated
+list of properly quoted pathname prefixes, constructed from its
+argument. For example, if @samp{$url} is @samp{/local/user/local?a=1},
+then the expansion of @samp{$(urlprefixes $url)} is:
+
+@example
+'/local/user/local','/local/user','/local'
+@end example
+
@node Rewrite
@chapter The @code{rewrite} Function

Return to:

Send suggestions and report system problems to the System administrator.