diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-07-12 18:05:47 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-07-12 18:05:47 +0300 |
commit | beec6178d1294a3b339098fe17ba23ef67a4bada (patch) | |
tree | d8b2074bd316cce6a163065b09be7ab37f4af2fd /src/dbrw.h | |
parent | 8afb551c895d6870b0d4f427fa8205ae45ad0bf9 (diff) | |
download | vmod-dbrw-beec6178d1294a3b339098fe17ba23ef67a4bada.tar.gz vmod-dbrw-beec6178d1294a3b339098fe17ba23ef67a4bada.tar.bz2 |
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.
<dbrw_config> (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.
Diffstat (limited to 'src/dbrw.h')
-rw-r--r-- | src/dbrw.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -27,17 +27,22 @@ enum { state_connected, state_result, state_error, 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 { int state; struct dbrw_config *conf; void *data; |