diff options
author | Stefan Fritsch <sf@apache.org> | 2010-11-28 14:01:59 +0100 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2010-11-28 14:01:59 +0100 |
commit | 40a73293597c6daa1f84c267a1ce5c23638436f5 (patch) | |
tree | 36ce2a6e6ce696424541fc6419ebc5c45b58b500 /modules/metadata | |
parent | Fix segfault on parse error (diff) | |
download | apache2-40a73293597c6daa1f84c267a1ce5c23638436f5.tar.xz apache2-40a73293597c6daa1f84c267a1ce5c23638436f5.zip |
Fix SetEnvIfExpr to work with expressions that do not set the regexp
reference data.
Add some trace logging.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1039876 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/metadata')
-rw-r--r-- | modules/metadata/mod_setenvif.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/modules/metadata/mod_setenvif.c b/modules/metadata/mod_setenvif.c index 5a3cac2720..9676603fa5 100644 --- a/modules/metadata/mod_setenvif.c +++ b/modules/metadata/mod_setenvif.c @@ -637,16 +637,19 @@ static int match_headers(request_rec *r) val_len = val ? strlen(val) : 0; } - /* - * A NULL value indicates that the header field or special entity - * wasn't present or is undefined. Represent that as an empty string - * so that REs like "^$" will work and allow envariable setting - * based on missing or empty field. - */ - if (val == NULL) { - val = ""; - val_len = 0; - } + } + + /* + * A NULL value indicates that the header field or special entity + * wasn't present or is undefined. Represent that as an empty string + * so that REs like "^$" will work and allow envariable setting + * based on missing or empty field. This is also necessary to make + * ap_pregsub work after evaluating an ap_expr which does set the + * regexp backref data. + */ + if (val == NULL) { + val = ""; + val_len = 0; } if ((b->pattern && apr_strmatch(b->pattern, val, val_len)) || @@ -675,6 +678,12 @@ static int match_headers(request_rec *r) } } } + if (APLOGrtrace2(r)) { + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, + "Setting envvar(s): %s", + apr_array_pstrcat(r->pool, arr, ' ')); + + } } } |