From beec6178d1294a3b339098fe17ba23ef67a4bada Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Fri, 12 Jul 2013 18:05:47 +0300 Subject: Optional flags modify the regexp handling, return status and query disposition. The flags can be supplied globally, using the "flags=X" parameter to drw.config, or for each record individually, by returning X in the fourth column of a tuple. In both cases X is a comma-separated list of: NC or nocase - force case-insensitive regexps case - force case-sensitive regexps (the default) QSA or qsappend - treat destination field as URL; append any query string from the original request URL to it QSD or qsdiscard - treat destination field as URL; discard any query string attached to the incoming URI R=NNN or redirect=NNN - on success, set the X-VMOD-DBRW-Status header to NNN, which must be a valid HTTP status code. * src/dbrw.h [HTTP_STATUS_LEN]: New define. (qdisp, regflags, status): New members. * src/vmod_dbrw.c (QDISP_NONE, QDISP_APPEND) (QDISP_APPEND): New constants. (dbrw_init): Fill allocated memory with zeroes. (is_http_status,parse_flags): New static functions. (vmod_config): Re-initialize conf on failure. Initialize new members of struct dbrw_config. (expand_backref): Additional argument 'qry' supplies the query part to be appended to the resulting string. (findmatch): Accept four fields per tuple, the optional fourth one supplying flags. --- src/dbrw.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/dbrw.h') diff --git a/src/dbrw.h b/src/dbrw.h index beebc5e..0721247 100644 --- a/src/dbrw.h +++ b/src/dbrw.h @@ -30,11 +30,16 @@ enum { state_disabled }; +#define HTTP_STATUS_LEN 3 + struct dbrw_config { int debug_level; struct dbrw_backend *backend; char **param; char *query; + int qdisp; + int regflags; + char status[HTTP_STATUS_LEN+1]; }; struct dbrw_connection { -- cgit v1.2.1