httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodent of Unusual Size <Ken.C...@Golux.Com>
Subject [PATCH] Add protocol to things SetEnvIf can test
Date Mon, 17 May 1999 17:51:01 GMT
Something I wanted to do recently to conditionalise rewrites
revealed that the request protocol wasn't one of the fields
that SetEnvIf[NoCase] can test.  So here's a patch.

The usual keyword in CGI, SSI, and mod_rewrite for this
quantity is "SERVER_PROTOCOL", but that seemed counterintuitive
to me for this case.  Any opinions on whether it should be
SERVER_PROTOCOL or REQUEST_PROTOCOL?  I chose the latter
because it seems more appropriate to what's being tested.
-- 
#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: htdocs/manual/mod/mod_setenvif.html
===================================================================
RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_setenvif.html,v
retrieving revision 1.5
diff -u -r1.5 mod_setenvif.html
--- mod_setenvif.html	1998/05/28 14:06:54	1.5
+++ mod_setenvif.html	1999/05/17 17:43:12
@@ -260,7 +260,8 @@
   <A
    HREF="directive-dict.html#Compatibility"
    REL="Help"
-  ><STRONG>Compatibility:</STRONG></A> Apache 1.3 and above
+  ><STRONG>Compatibility:</STRONG></A> Apache 1.3 and above; the
+  Request_Protocol keyword is only available with 1.3.7 and later
   </P>
   <P>
   The <SAMP>SetEnvIf</SAMP> directive defines environment variables
@@ -284,6 +285,10 @@
    </LI>
    <LI><SAMP>Request_Method</SAMP> - the name of the method being used
     (<SAMP>GET</SAMP>, <SAMP>POST</SAMP>, <EM>et cetera</EM>)
+   </LI>
+   <LI><SAMP>Request_Protocol</SAMP> - the name and version of the protocol
+    with which the request was made (<EM>e.g.</EM>, "HTTP/0.9", "HTTP/1.1",
+    <EM>etc.</EM>)
    </LI>
    <LI><SAMP>Request_URI</SAMP> - the portion of the URL following the
     scheme and host portion
Index: src/CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1359
diff -u -r1.1359 CHANGES
--- CHANGES	1999/05/17 08:00:02	1.1359
+++ CHANGES	1999/05/17 17:43:27
@@ -1,5 +1,9 @@
 Changes with Apache 1.3.7
 
+  *) Add 'Request_Protocol' special keyword to mod_setenvif so that
+     environment variables can be set according to the protocol version
+     (e.g., HTTP/0.9 or HTTP/1.1) of the request.  [Ken Coar]
+
   *) Add DSO support for OpenStep (Mach 4.2) platform.
      [Ralf S. Engelschall, Rex Dieter <rdieter@math.unl.edu>] PR#3997
 
Index: src/modules/standard/mod_setenvif.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
retrieving revision 1.26
diff -u -r1.26 mod_setenvif.c
--- mod_setenvif.c	1999/01/01 19:05:13	1.26
+++ mod_setenvif.c	1999/05/17 17:43:42
@@ -125,7 +125,8 @@
     SPECIAL_REMOTE_HOST,
     SPECIAL_REMOTE_USER,
     SPECIAL_REQUEST_URI,
-    SPECIAL_REQUEST_METHOD
+    SPECIAL_REQUEST_METHOD,
+    SPECIAL_REQUEST_PROTOCOL
 };
 typedef struct {
     char *name;                 /* header name */
@@ -241,6 +242,9 @@
 	else if (!strcasecmp(fname, "request_method")) {
 	    new->special_type = SPECIAL_REQUEST_METHOD;
 	}
+	else if (!strcasecmp(fname, "request_protocol")) {
+	    new->special_type = SPECIAL_REQUEST_PROTOCOL;
+	}
 	else {
 	    new->special_type = SPECIAL_NOT;
 	}
@@ -354,6 +358,9 @@
 		break;
 	    case SPECIAL_REQUEST_METHOD:
 		val = r->method;
+		break;
+	    case SPECIAL_REQUEST_PROTOCOL:
+		val = r->protocol;
 		break;
 	    case SPECIAL_NOT:
 		val = ap_table_get(r->headers_in, b->name);

Mime
View raw message