]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* mod_alias: Ensure Redirect emits HTTP-compliant URLs.
authorJim Jagielski <jim@apache.org>
Mon, 6 Jul 2009 16:55:28 +0000 (16:55 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 6 Jul 2009 16:55:28 +0000 (16:55 +0000)
   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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@791541 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/mappers/mod_alias.c

diff --git a/CHANGES b/CHANGES
index 16bf4246de04599a8c7321f08a88b81906209a87..7a1ddbc53c77bc3918334ba07e0db32c61549cc3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -27,6 +27,9 @@ Changes with Apache 2.2.12
      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>]
 
diff --git a/STATUS b/STATUS
index 2ae4e777be10b2e128f5280357f97261c79b52e6..6a8ccd6dde600a2d5599bbdb3f1f6d8b69de16de 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -85,16 +85,6 @@ RELEASE SHOWSTOPPERS:
 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:
index bde1703de7d01892d9e2b12404ba7a8c6209ed57..65a720a4fa40bac831126d98ebe91202fab37baa 100644 (file)
@@ -405,8 +405,29 @@ static int translate_alias_redir(request_rec *r)
 
     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);