You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2009/07/06 18:55:28 UTC

svn commit: r791541 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/mappers/mod_alias.c

Author: jim
Date: Mon Jul  6 16:55:28 2009
New Revision: 791541

URL: http://svn.apache.org/viewvc?rev=791541&view=rev
Log:
 * mod_alias: Ensure Redirect emits HTTP-compliant URLs.
   PR 44020
   trunk patch:
     http://svn.apache.org/viewvc?view=rev&rev=785575
   2.2.x patch:
     http://people.apache.org/~rpluem/patches/foreign_patches/niq_44020.diff
   NOTE: I'm recommending different versions because the trunk
   patch is too strict for a stable line and may "break" broken
   configs thought by their users to be working.


Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/mappers/mod_alias.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=791541&r1=791540&r2=791541&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Mon Jul  6 16:55:28 2009
@@ -27,6 +27,9 @@
      different security issues which may affect particular configurations
      and third-party modules.
 
+  *) mod_alias: Ensure Redirect emits HTTP-compliant URLs.
+     PR 44020
+
   *) mod_proxy_http: fix case sensitivity checking transfer encoding
      PR 47383 [Ryuzo Yamamoto <ryuzo.yamamoto gmail.com>]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=791541&r1=791540&r2=791541&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Mon Jul  6 16:55:28 2009
@@ -85,16 +85,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
- * mod_alias: Ensure Redirect emits HTTP-compliant URLs.
-   PR 44020
-   trunk patch:
-     http://svn.apache.org/viewvc?view=rev&rev=785575
-   2.2.x patch:
-     http://people.apache.org/~rpluem/patches/foreign_patches/niq_44020.diff
-   NOTE: I'm recommending different versions because the trunk
-   patch is too strict for a stable line and may "break" broken
-   configs thought by their users to be working.
-   +1: niq, rpluem, jim
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:

Modified: httpd/httpd/branches/2.2.x/modules/mappers/mod_alias.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/mappers/mod_alias.c?rev=791541&r1=791540&r2=791541&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/mappers/mod_alias.c (original)
+++ httpd/httpd/branches/2.2.x/modules/mappers/mod_alias.c Mon Jul  6 16:55:28 2009
@@ -405,8 +405,29 @@
 
     if ((ret = try_alias_list(r, serverconf->redirects, 1, &status)) != NULL) {
         if (ap_is_HTTP_REDIRECT(status)) {
-            /* include QUERY_STRING if any */
-            if (r->args) {
+            char *orig_target = ret;
+            if (ret[0] == '/') {
+
+                ret = ap_construct_url(r->pool, ret, r);
+                ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+                              "incomplete redirection target of '%s' for "
+                              "URI '%s' modified to '%s'",
+                              orig_target, r->uri, ret);
+            }
+            if (!ap_is_url(ret)) {
+                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                              "cannot redirect '%s' to '%s'; "
+                              "target is not a valid absoluteURI or abs_path",
+                              r->uri, ret);
+                /* restore the config value, so as not to get a
+                 * "regression" on existing "working" configs.
+                 */
+                ret = orig_target;
+            }
+            /* append requested query only, if the config didn't
+             * supply its own.
+             */
+            if (r->args && !ap_strchr(ret, '?')) {
                 ret = apr_pstrcat(r->pool, ret, "?", r->args, NULL);
             }
             apr_table_setn(r->headers_out, "Location", ret);