From: Ken Coar Date: Thu, 31 Jan 2002 20:29:41 +0000 (+0000) Subject: If the RedirectMatch target is an abs_path, make it an absoluteURI X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64ad9ca8997bfee7283b2b3e2a303f2832267dee;p=thirdparty%2Fapache%2Fhttpd.git If the RedirectMatch target is an abs_path, make it an absoluteURI git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@93142 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/CHANGES b/src/CHANGES index 4e0f37621e4..bbbcd297515 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -3,8 +3,9 @@ Changes with Apache 1.3.24 *) The Location: response header field, used for external redirect, *must* be an absoluteURI. The Redirect directive tested for that, but RedirectMatch didn't -- it would allow - almost anything through. Now it, too, will correctly varf - if the redirection target isn't an absoluteURI. [Ken Coar] + almost anything through. Now it will try to turn an abs_path + into an absoluteURI, but it will correctly varf like Redirect + if the final redirection target isn't an absoluteURI. [Ken Coar] *) apxs: fix bug that prevented -S option from containing quotes. [Ben Laurie] diff --git a/src/modules/standard/mod_alias.c b/src/modules/standard/mod_alias.c index f6ae1bcc5c8..7d93b6bed38 100644 --- a/src/modules/standard/mod_alias.c +++ b/src/modules/standard/mod_alias.c @@ -393,11 +393,20 @@ static int fixup_redir(request_rec *r) if ((ret = try_alias_list(r, dirconf->redirects, 1, &status)) != NULL) { if (ap_is_HTTP_REDIRECT(status)) { + if (ret[0] == '/') { + char *orig_target = ret; + + ret = ap_construct_url(r->pool, ret, r); + ap_log_rerror(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, r, + "incomplete redirection target of '%s' for " + "URI '%s' modified to '%s'", + orig_target, r->uri, ret); + } if (!ap_is_url(ret)) { status = HTTP_INTERNAL_SERVER_ERROR; ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, "cannot redirect '%s' to '%s'; " - "target is not a valid absoluteURI", + "target is not a valid absoluteURI or abs_path", r->uri, ret); } else {