coar 99/06/04 11:40:01
Modified: src CHANGES
htdocs/manual/mod mod_setenvif.html
src/modules/standard mod_setenvif.c
Log:
A minor enhancement to SetEnvIf*: allow it to test envariables
as well as request attributes.
Revision Changes Path
1.1371 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1370
retrieving revision 1.1371
diff -u -r1.1370 -r1.1371
--- CHANGES 1999/06/04 18:30:16 1.1370
+++ CHANGES 1999/06/04 18:39:57 1.1371
@@ -1,5 +1,8 @@
Changes with Apache 1.3.7
+ *) Allow SetEnvIf[NoCase] to test environment variables as well
+ as header fields and request attributes. [Ken Coar]
+
*) Fix mod_autoindex's handling of ScanHTMLTitles when file
content-types are "text/html;parameters". PR#4524 [Ken Coar]
1.7 +24 -4 apache-1.3/htdocs/manual/mod/mod_setenvif.html
Index: mod_setenvif.html
===================================================================
RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_setenvif.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mod_setenvif.html 1999/05/19 13:26:06 1.6
+++ mod_setenvif.html 1999/06/04 18:40:00 1.7
@@ -261,7 +261,8 @@
HREF="directive-dict.html#Compatibility"
REL="Help"
><STRONG>Compatibility:</STRONG></A> Apache 1.3 and above; the
- Request_Protocol keyword is only available with 1.3.7 and later
+ Request_Protocol keyword and environment-variable matching are only
+ available with 1.3.7 and later
</P>
<P>
The <SAMP>SetEnvIf</SAMP> directive defines environment variables
@@ -299,15 +300,34 @@
<SAMP>Host</SAMP>, <SAMP>User-Agent</SAMP>, and <SAMP>Referer</SAMP>.
</P>
<P>
+ If the <EM>attribute</EM> name doesn't match any of the special keywords,
+ nor any of the request's header field names, it is tested as the name
+ of an environment variable in the list of those associated with the
request.
+ This allows <CODE>SetEnvIf</CODE> directives to test against the result
+ of prior matches.
+ </P>
+ <BLOCKQUOTE>
+ <STRONG>Only those environment variables defined by earlier
+ <CODE>SetEnvIf[NoCase]</CODE> directives are available for testing in
+ this manner. 'Earlier' means that they were defined at a broader scope
+ (such as server-wide) or previously in the current directive's
+ scope.</STRONG>
+ </BLOCKQUOTE>
+ <P>
Example:
</P>
<PRE>
- SetEnvIf Request_URI "\.(gif)|(jpg)|(xbm)$" object_is_image
+ SetEnvIf Request_URI "\.gif$" object_is_image=gif
+ SetEnvIf Request_URI "\.jpg$" object_is_image=jpg
+ SetEnvIf Request_URI "\.xbm$" object_is_image=xbm
+ :
SetEnvIf Referer www\.mydomain\.com intra_site_referral
+ :
+ SetEnvIf object_is_image xbm XBIT_PROCESSING=1
</PRE>
<P>
- The first will set the envariable <SAMP>object_is_image</SAMP> if the
- request was for an image file, and the second sets
+ The first three will set the envariable <SAMP>object_is_image</SAMP> if the
+ request was for an image file, and the fourth sets
<SAMP>intra_site_referral</SAMP> if the referring page was somewhere
on the <SAMP>www.mydomain.com</SAMP> Web site.
</P>
1.29 +3 -0 apache-1.3/src/modules/standard/mod_setenvif.c
Index: mod_setenvif.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- mod_setenvif.c 1999/05/21 12:16:24 1.28
+++ mod_setenvif.c 1999/06/04 18:40:00 1.29
@@ -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;
}
}