aboutsummaryrefslogtreecommitdiff
path: root/doc/vmod-dbrw.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/vmod-dbrw.texi')
-rw-r--r--doc/vmod-dbrw.texi38
1 files changed, 37 insertions, 1 deletions
diff --git a/doc/vmod-dbrw.texi b/doc/vmod-dbrw.texi
index 734dadb..6a987ed 100644
--- a/doc/vmod-dbrw.texi
+++ b/doc/vmod-dbrw.texi
@@ -129,13 +129,20 @@ This latter form can be used in contexts where the variable reference is
immediately followed by a letter, digit or underscore, to prevent it
from being counted as a part of the name. Special syntax is available
for substituting default values and invoking built-in functions during
the expansion of the query. @xref{Expansions}, for a detailed
description of these.
+@anchor{X-VMOD-DBRW-Error}
+@vindex X-VMOD-DBRW-Error
Having undergone expansions, the query is sent to the database server.
+If the query returns no records or if an error occured, @code{rewrite}
+returns empty string. In case of error, it also sets the HTTP header
+@samp{X-VMOD-DBRW-Error: 1}. It can be used in VLC code to provide a
+special handling for such failures.
+
The returned set of records (if non-empty) is processed depending on the
number of fields it contains.
@cindex result interpretation
@anchor{result interpretation}
@cindex strict matching
@@ -163,13 +170,13 @@ subexpression in @var{regexp}. For compatibility with the traditional
usage, the @code{\@var{digit}} notation is also allowed. The
resulting value is then returned to the caller.
@cindex flags
@anchor{flags}
Optional @var{flags} column is a comma-separated list of flags that
-modify regular expression handling:
+control the matching algorithm.
@table @samp
@kindex NC
@kindex nocase
@cindex regular expression, case-insensitive
@cindex case-insensitive regular expression
@@ -180,12 +187,17 @@ Treat @var{regexp} as case-insensitive regular expression.
@kindex case
@cindex regular expression, case-sensitive
@cindex case-sensitive regular expression
@item case
Treat @var{regexp} as case-sensitive (default).
+@kindex eq
+@cindex exact matching
+@item eq
+Use exact string matching.
+
@kindex QSA
@kindex qsappend
@cindex query string handling
@cindex append query string
@item QSA
@itemx qsappend
@@ -206,12 +218,18 @@ the original @var{value}.
@cindex redirection code
@cindex status code
@item redirect=@var{code}
@item R=@var{code}
On success, set the @samp{X-VMOD-DBRW-Status} header to @var{code},
which must be a valid HTTP status code.
+
+@kindex regex
+@cindex regular expression matching
+@item regex
+Use regular expression matching. This is the default. This flag is
+provided for completeness sake, as a counterpart of @samp{eq}.
@end table
If @var{regexp} or @var{value} is NULL, strict matching is assumed
(@pxref{strict matching}).
If @var{flags} is NULL, it is ignored.
@@ -698,12 +716,30 @@ sub vcl_synth @{
@end example
The @code{X-VMOD-DBRW-Status} header, if set, contains the status code to be
returned to the client (@pxref{X-VMOD-DBRW-Status}). Notice the use
of the @command{vmod_std} module to cast it to integer.
+If an error occured during the rewrite, it is recommended to not
+cache the response. This way the next request will call rewrite again
+and eventually complete the rewriting. This can be achieved using the
+following @code{vcl_backend_response} fragment:
+
+@example
+@group
+sub vcl_backend_response
+@{
+ if (bereq.http.X-VMOD-DBRW-Error == "1") @{
+ set beresp.uncacheable = true;
+ return (deliver);
+ @}
+@}
+@end group
+@end example
+
+
@node Reporting Bugs
@chapter How to Report a Bug
Email bug reports to @email{gray@@gnu.org}.
As the purpose of bug reporting is to improve software, please be

Return to:

Send suggestions and report system problems to the System administrator.