]> granicus.if.org Git - apache/commitdiff
Make the REQUEST_SCHEME variable available to scripts and mod_rewrite
authorStefan Fritsch <sf@apache.org>
Thu, 30 Dec 2010 12:34:19 +0000 (12:34 +0000)
committerStefan Fritsch <sf@apache.org>
Thu, 30 Dec 2010 12:34:19 +0000 (12:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053872 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_rewrite.html.en
docs/manual/mod/mod_rewrite.xml
modules/mappers/mod_rewrite.c
server/util_script.c

diff --git a/CHANGES b/CHANGES
index e6099e76f97bc2adb21efac59c889855ae26dc50..c6821771094a1f414462b61cfa21a88c9a3553cd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.11
 
+  *) core, mod_rewrite: Make the REQUEST_SCHEME variable available to
+     scripts and mod_rewrite. [Stefan Fritsch]
+
   *) mod_rewrite: Allow to use arbitrary boolean expressions (ap_expr) in
      RewriteCond. [Stefan Fritsch]
 
index 800dcd8c69b03d046168347bf849c08ea1604359..dac6a11f583acb7cbed710c9af745cd48f3d1fce 100644 (file)
@@ -263,6 +263,7 @@ RewriteRule ^index\.html$  newsite.html
                  REQUEST_FILENAME<br />
                  IS_SUBREQ<br />
                  HTTPS<br />
+                 REQUEST_SCHEME<br />
               </td>
             </tr>
           </table>
@@ -325,6 +326,12 @@ RewriteRule ^index\.html$  newsite.html
                   can be safely used regardless of whether or not
                   <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> is loaded).</dd>
 
+                  <dt><code>REQUEST_SCHEME</code></dt>
+
+                  <dd>Will contain the scheme of the request (ususally
+                  "http" or "https"). This value can be influenced with
+                  <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>.</dd>
+
                 </dl>
 </div>
         </li>
index ba0060a4c615935a4e3a31ee12465c43961f1de6..f13fe66189e631c4945cb5b3cfc724a5544be6c4 100644 (file)
@@ -436,6 +436,7 @@ RewriteRule ^index\.html$  newsite.html
                  REQUEST_FILENAME<br />
                  IS_SUBREQ<br />
                  HTTPS<br />
+                 REQUEST_SCHEME<br />
               </td>
             </tr>
           </table>
@@ -498,6 +499,12 @@ RewriteRule ^index\.html$  newsite.html
                   can be safely used regardless of whether or not
                   <module>mod_ssl</module> is loaded).</dd>
 
+                  <dt><code>REQUEST_SCHEME</code></dt>
+
+                  <dd>Will contain the scheme of the request (ususally
+                  "http" or "https"). This value can be influenced with
+                  <directive module="core">ServerName</directive>.</dd>
+
                 </dl>
 </note>
         </li>
index 83ef53c386a5557368680fae4b47ce818c6fc167..73f0a882f272d8e28d5459bdd360aefaf597c46c 100644 (file)
@@ -2089,9 +2089,12 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
             if (*var == 'H' && !strcmp(var, "HTTP_FORWARDED")) {
                 result = lookup_header("Forwarded", ctx);
             }
-            else if (!strcmp(var, "REQUEST_METHOD")) {
+            else if (var[8] == 'M' && !strcmp(var, "REQUEST_METHOD")) {
                 result = r->method;
             }
+            else if (!strcmp(var, "REQUEST_SCHEME")) {
+                result = ap_http_scheme(r);
+            }
             break;
 
         case 15:
index d8c3f1f297373ad6796a3beee40f2712bdc9ceb6..2d070816f0536ac49efecf2014dc106823523afe 100644 (file)
@@ -337,6 +337,7 @@ AP_DECLARE(void) ap_add_cgi_vars(request_rec *r)
     apr_table_setn(e, "GATEWAY_INTERFACE", "CGI/1.1");
     apr_table_setn(e, "SERVER_PROTOCOL", r->protocol);
     apr_table_setn(e, "REQUEST_METHOD", r->method);
+    apr_table_setn(e, "REQUEST_SCHEME", ap_http_scheme(r));
     apr_table_setn(e, "QUERY_STRING", r->args ? r->args : "");
     apr_table_setn(e, "REQUEST_URI", original_uri(r));