You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <Ke...@Golux.Com> on 1999/05/22 01:57:34 UTC

[PATCH] Extend SetEnvIf* matching to envariables

I have no idea whether anyone else would consider this a good
idea or not, so I'm floating it for opinions.

The attached patch (against HEAD) extends SetEnvIf*'s matching
a bit.  The current behaviour is:

1. check the name against special keywords (e.g., Request_URI);
   if no match,
2. treat the name as a field name and work with any value for it
   in r->headers_in

The extension is to add another possibility:

1. check the name against special keywords (e.g., Request_URI);
   if no match,
2. check the name against field names in r->headers_in; if no
   match,
3. treat the name as an envariable name and work with any
   value for it in r->subprocess_env

The idea is to allow SetEnvIf* checks to use values set by
earlier or outer-scope ones, or from the server's environment.
Of course, due to mod_setenvif's position in the phase order,
it can't use anything from SetEnv or mod_rewrite.

Does anyone else think this is potentially useful?  It solved
an issue I had with special-casing some situations, but they
could be finessed with mod_rewrite if I wanted to use that
big a hammer.
-- 
#ken    P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>


Index: modules/standard/mod_setenvif.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
retrieving revision 1.27
diff -u -r1.27 mod_setenvif.c
--- mod_setenvif.c	1999/05/19 13:26:09	1.27
+++ mod_setenvif.c	1999/05/21 23:45:06
@@ -364,6 +364,9 @@
 		break;
 	    case SPECIAL_NOT:
 		val = ap_table_get(r->headers_in, b->name);
+		if (val == NULL) {
+		    val = ap_table_get(r->subprocess_env, b->name);
+		}
 		break;
 	    }
         }