You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/11/28 14:02:00 UTC

svn commit: r1039876 - /httpd/httpd/trunk/modules/metadata/mod_setenvif.c

Author: sf
Date: Sun Nov 28 13:01:59 2010
New Revision: 1039876

URL: http://svn.apache.org/viewvc?rev=1039876&view=rev
Log:
Fix SetEnvIfExpr to work with expressions that do not set the regexp
reference data.
Add some trace logging.

Modified:
    httpd/httpd/trunk/modules/metadata/mod_setenvif.c

Modified: httpd/httpd/trunk/modules/metadata/mod_setenvif.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_setenvif.c?rev=1039876&r1=1039875&r2=1039876&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_setenvif.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_setenvif.c Sun Nov 28 13:01:59 2010
@@ -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, ' '));
+
+            }
         }
     }