]> granicus.if.org Git - apache/commitdiff
Back out the 1.45 change to util_script.c. This change made
authorRyan Bloom <rbb@apache.org>
Tue, 4 Sep 2001 01:38:01 +0000 (01:38 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 4 Sep 2001 01:38:01 +0000 (01:38 +0000)
us set the environment variable REQUEST_URI to the redirected
URI, instead of the originally requested URI.

PR: 7580
Submitted by: Taketo Kabe <kabe@sra-tohoku.co.jp>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90886 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/util_script.c

diff --git a/CHANGES b/CHANGES
index ef4059e776d643b1c2c98602154c68ed7e8cd59f..139704a5f4dc419423ceb6f73c6ae520af4df3c7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.26-dev
 
+  *) Back out the 1.45 change to util_script.c.  This change made
+     us set the environment variable REQUEST_URI to the redirected
+     URI, instead of the originally requested URI.
+     [Taketo Kabe <kabe@sra-tohoku.co.jp>]
+
   *) Make mod_include do lazy evaluation of potentially expensive to
      compute variables.  [Brian Pane <bpane@pacbell.net>]
 
index e2cc7e8920656793320a349db1b37bad559fca42..9e485ef9c48a1e2eca64e1f7687401bd7eb22228 100644 (file)
@@ -313,6 +313,34 @@ AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info)
     return lu;
 }
 
+/* Obtain the Request-URI from the original request-line, returning
+ * a new string from the request pool containing the URI or "".
+ */
+static char *original_uri(request_rec *r)
+{
+    char *first, *last;
+
+    if (r->the_request == NULL) {
+       return (char *) apr_pcalloc(r->pool, 1);
+    }
+
+    first = r->the_request;    /* use the request-line */
+
+    while (*first && !apr_isspace(*first)) {
+       ++first;                /* skip over the method */
+    }
+    while (apr_isspace(*first)) {
+       ++first;                /*   and the space(s)   */
+    }
+
+    last = first;
+    while (*last && !apr_isspace(*last)) {
+       ++last;                 /* end at next whitespace */
+    }
+
+    return apr_pstrndup(r->pool, first, last - first);
+}
+
 AP_DECLARE(void) ap_add_cgi_vars(request_rec *r)
 {
     apr_table_t *e = r->subprocess_env;
@@ -321,7 +349,7 @@ AP_DECLARE(void) ap_add_cgi_vars(request_rec *r)
     apr_table_setn(e, "SERVER_PROTOCOL", r->protocol);
     apr_table_setn(e, "REQUEST_METHOD", r->method);
     apr_table_setn(e, "QUERY_STRING", r->args ? r->args : "");
-    apr_table_setn(e, "REQUEST_URI", r->unparsed_uri);
+    apr_table_setn(e, "REQUEST_URI", original_uri(r)); 
 
     /* Note that the code below special-cases scripts run from includes,
      * because it "knows" that the sub_request has been hacked to have the