Return-Path:
X-Original-To: apmail-httpd-cvs-archive@www.apache.org
Delivered-To: apmail-httpd-cvs-archive@www.apache.org
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by minotaur.apache.org (Postfix) with SMTP id 2B7597FB7
for ;
Thu, 1 Dec 2011 12:47:05 +0000 (UTC)
Received: (qmail 52908 invoked by uid 500); 1 Dec 2011 12:47:05 -0000
Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org
Received: (qmail 52864 invoked by uid 500); 1 Dec 2011 12:47:05 -0000
Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm
Precedence: bulk
Reply-To: dev@httpd.apache.org
list-help:
list-unsubscribe:
List-Post:
List-Id:
Delivered-To: mailing list cvs@httpd.apache.org
Received: (qmail 52857 invoked by uid 99); 1 Dec 2011 12:47:04 -0000
Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136)
by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2011 12:47:04 +0000
X-ASF-Spam-Status: No, hits=-2000.0 required=5.0
tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4)
by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2011 12:47:03 +0000
Received: from eris.apache.org (localhost [127.0.0.1])
by eris.apache.org (Postfix) with ESMTP id 90A2F2388A3F;
Thu, 1 Dec 2011 12:46:43 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r1209057 - in /httpd/httpd/branches/2.4.x: ./ CHANGES
docs/manual/mod/mod_rewrite.xml modules/mappers/mod_rewrite.c
Date: Thu, 01 Dec 2011 12:46:42 -0000
To: cvs@httpd.apache.org
From: minfrin@apache.org
X-Mailer: svnmailer-1.0.8-patched
Message-Id: <20111201124643.90A2F2388A3F@eris.apache.org>
Author: minfrin
Date: Thu Dec 1 12:46:40 2011
New Revision: 1209057
URL: http://svn.apache.org/viewvc?rev=1209057&view=rev
Log:
Backport:
mod_rewrite: Add the AllowNoSlash RewriteOption, which makes it possible
for RewriteRules to be placed in .htaccess files that match the directory
with no trailing slash. PR 48304.
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/CHANGES
httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml
httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 1 12:46:40 2011
@@ -1,3 +1,3 @@
/httpd/httpd/branches/revert-ap-ldap:1150158-1150173
/httpd/httpd/branches/wombat-integration:723609-723841
-/httpd/httpd/trunk:1201042,1201111,1201194,1201198,1201202,1202456,1202886,1203859,1204630,1204968,1204990,1205061,1205075,1205379,1205885,1206291,1206587,1207719,1208753,1208835
+/httpd/httpd/trunk:1201042,1201111,1201194,1201198,1201202,1202456,1202886,1203859,1204630,1204968,1204990,1205061,1205075,1205379,1205885,1206291,1206587,1207719,1208753,1208835,1209053
Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1209057&r1=1209056&r2=1209057&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Thu Dec 1 12:46:40 2011
@@ -1,6 +1,11 @@
-*- coding: utf-8 -*-
Changes with Apache 2.4.0
+ *) mod_rewrite: Add the AllowNoSlash RewriteOption, which makes it possible
+ for RewriteRules to be placed in .htaccess files that match the directory
+ with no trailing slash. PR 48304.
+ [Matthew Byng-Maddick ]
+
*) mod_session_crypto: Add a SessionCryptoPassphraseFile directive so that
the administrator can hide the keys from the configuration. [Graham
Leggett]
Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml?rev=1209057&r1=1209056&r2=1209057&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml Thu Dec 1 12:46:40 2011
@@ -171,6 +171,21 @@ later
Available in Apache HTTP Server 2.3.10 and later.
+ AllowNoSlash
+
+ By default, mod_rewrite will ignore URLs that map to a
+ directory on disk but lack a trailing slash, in the expectation that
+ the mod_dir module will issue the client with a redirect to
+ the canonical URL with a trailing slash.
+
+ When the DirectorySlash directive
+ is set to off, the AllowNoSlash
option can be enabled to ensure
+ that rewrite rules are no longer ignored. This option makes it possible to
+ apply rewrite rules within .htaccess files that match the directory without
+ a trailing slash, if so desired. Available in Apache HTTP Server 2.4.0 and
+ later.
+
+
Modified: httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c?rev=1209057&r1=1209056&r2=1209057&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c Thu Dec 1 12:46:40 2011
@@ -189,6 +189,7 @@ static const char* really_last_key = "re
#define OPTION_NONE 1<<0
#define OPTION_INHERIT 1<<1
#define OPTION_INHERIT_BEFORE 1<<2
+#define OPTION_NOSLASH 1<<3
#ifndef RAND_MAX
#define RAND_MAX 32767
@@ -2882,6 +2883,9 @@ static const char *cmd_rewriteoptions(cm
else if (!strcasecmp(w, "inheritbefore")) {
options |= OPTION_INHERIT_BEFORE;
}
+ else if (!strcasecmp(w, "allownoslash")) {
+ options |= OPTION_NOSLASH;
+ }
else if (!strncasecmp(w, "MaxRedirects=", 13)) {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
"RewriteOptions: MaxRedirects option has been "
@@ -4698,9 +4702,10 @@ static int hook_fixup(request_rec *r)
/*
* .htaccess file is called before really entering the directory, i.e.:
* URL: http://localhost/foo and .htaccess is located in foo directory
- * Ignore such attempts, since they may lead to undefined behaviour.
+ * Ignore such attempts, allowing mod_dir to direct the client to the
+ * canonical URL. This can be controlled with the AllowNoSlash option.
*/
- if (!is_proxyreq) {
+ if (!is_proxyreq && !(dconf->options & OPTION_NOSLASH)) {
l = strlen(dconf->directory) - 1;
if (r->filename && strlen(r->filename) == l &&
(dconf->directory)[l] == '/' &&