From 40a73293597c6daa1f84c267a1ce5c23638436f5 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sun, 28 Nov 2010 13:01:59 +0000 Subject: 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 --- modules/metadata/mod_setenvif.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'modules') 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, ' ')); + + } } } -- cgit v1.2.3