Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 257F810DA2 for ; Tue, 28 Jan 2014 18:22:04 +0000 (UTC) Received: (qmail 85659 invoked by uid 500); 28 Jan 2014 18:22:02 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 85561 invoked by uid 500); 28 Jan 2014 18:22:01 -0000 Mailing-List: contact dev-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 dev@httpd.apache.org Received: (qmail 85553 invoked by uid 99); 28 Jan 2014 18:22:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jan 2014 18:22:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of trawick@gmail.com designates 209.85.217.179 as permitted sender) Received: from [209.85.217.179] (HELO mail-lb0-f179.google.com) (209.85.217.179) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jan 2014 18:21:55 +0000 Received: by mail-lb0-f179.google.com with SMTP id l4so664564lbv.24 for ; Tue, 28 Jan 2014 10:21:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ywp7FYUTV++KlDgO5tNYaywt5De+wkWkOw6nLQTEN+g=; b=NLaja06YWeoBkwUxXIsQh5eTtriEF8mABAyKuxa/HkRm1LLqRGRZlcw16LbNirPO4g TGWFoVRwSfpaLl+YBiGnDZ8OKRCc5EXSgYwsvNWaJTErGuMfMZ966dC6OStLr15JTsYQ ZX7pYpodhBmw8OApFgx1TuJGWoyRLnMKYwSPOvgFxsJukZP/cQ0purU/+Um1e31g4JCw RJzTmyNtEsFViV2H/i7n7saNrYeb3oS++aMmHpKggzVOshWBJVctaxBNHU4fiM9T3gbX wP53pFBIJ+wO4tpjgXhYnzdG7v5OjAAgTPQmSOFb5BlrL+uqZ45rnOIKGQJv2AbSHrQe 6fyw== MIME-Version: 1.0 X-Received: by 10.152.203.193 with SMTP id ks1mr1913251lac.0.1390933294581; Tue, 28 Jan 2014 10:21:34 -0800 (PST) Received: by 10.114.3.144 with HTTP; Tue, 28 Jan 2014 10:21:34 -0800 (PST) In-Reply-To: <20140113014212.B61AA23888FE@eris.apache.org> References: <20140113014212.B61AA23888FE@eris.apache.org> Date: Tue, 28 Jan 2014 13:21:34 -0500 Message-ID: Subject: Re: svn commit: r1557640 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_dir.xml modules/mappers/mod_dir.c From: Jeff Trawick To: Apache HTTP Server Development List Content-Type: multipart/alternative; boundary=001a113470d2ee0e9a04f10be4ea X-Virus-Checked: Checked by ClamAV on apache.org --001a113470d2ee0e9a04f10be4ea Content-Type: text/plain; charset=ISO-8859-1 On Sun, Jan 12, 2014 at 8:42 PM, wrote: > Author: covener > Date: Mon Jan 13 01:42:12 2014 > New Revision: 1557640 > > URL: http://svn.apache.org/r1557640 > Log: > restore http://svn.apache.org/viewvc?view=revision&revision=233369 > under a configurable option: don't run mod_dir if r->handler is already > set. > > PR53794 > > > Modified: > httpd/httpd/trunk/CHANGES > httpd/httpd/trunk/docs/manual/mod/mod_dir.xml > httpd/httpd/trunk/modules/mappers/mod_dir.c > > Modified: httpd/httpd/trunk/CHANGES > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1557640&r1=1557639&r2=1557640&view=diff > > ============================================================================== > --- httpd/httpd/trunk/CHANGES [utf-8] (original) > +++ httpd/httpd/trunk/CHANGES [utf-8] Mon Jan 13 01:42:12 2014 > @@ -1,6 +1,10 @@ > -*- coding: > utf-8 -*- > Changes with Apache 2.5.0 > > + > + *) mod_dir: Add DirectoryCheckHandler to allow a 2.2-like behavior, > skipping > + execution when a handler is already set. PR53929. [Eric Covener] > + > *) mod_rewrite: Protect against looping with the [N] flag by enforcing a > default limit of 10000 iterations, and allowing each rule to change > its > limit. [Eric Covener] > > Modified: httpd/httpd/trunk/docs/manual/mod/mod_dir.xml > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_dir.xml?rev=1557640&r1=1557639&r2=1557640&view=diff > > ============================================================================== > --- httpd/httpd/trunk/docs/manual/mod/mod_dir.xml (original) > +++ httpd/httpd/trunk/docs/manual/mod/mod_dir.xml Mon Jan 13 01:42:12 2014 > @@ -274,5 +274,31 @@ a directory > > > > + > +DirectoryCheckHandler > +Toggle how this module responds when another handler is > configured > +DirectoryCheckHandler On|Off > +DirectorySlash Off > +server configvirtual > host > +directory.htaccess > +Indexes > +Available in 2.4.8 and later. Releases prior to 2.4 > implicitly > +act as if "DirectorySlash Off" was specified. > + > +

The DirectoryCheckHandler directive > determines > + whether mod_dir should check for directory indexes or > + add trailing slashes when some other handler has been configured for > + the current URL. Handlers can be set by directives such as > + SetHandler or by other modules, > + such as mod_rewrite during per-directory > substitutions. > +

> + > +

In releases prior to 2.4, this module did not take any action if > any > + other handler was configured for a URL. This allows directory indexes > to > + be served even when a SetHandler directive is > + specified for an entire directory, but it can also result in some > conflicts > + with modules such as mod_rewrite.

> +
> +
> At least one of the "DirectorySlash" occurrences is wrong. (I guess both are.) I wonder if there is a more intuitive directive name. What about DirectoryOverrideHandler? (with reversed sense of on/off) Is that more obvious than DirectoryCheckHandler? > > > Modified: httpd/httpd/trunk/modules/mappers/mod_dir.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_dir.c?rev=1557640&r1=1557639&r2=1557640&view=diff > > ============================================================================== > --- httpd/httpd/trunk/modules/mappers/mod_dir.c (original) > +++ httpd/httpd/trunk/modules/mappers/mod_dir.c Mon Jan 13 01:42:12 2014 > @@ -44,6 +44,7 @@ typedef enum { > typedef struct dir_config_struct { > apr_array_header_t *index_names; > moddir_cfg do_slash; > + moddir_cfg checkhandler; > int redirect_index; > const char *dflt; > } dir_config_rec; > @@ -86,6 +87,13 @@ static const char *configure_slash(cmd_p > d->do_slash = arg ? MODDIR_ON : MODDIR_OFF; > return NULL; > } > +static const char *configure_checkhandler(cmd_parms *cmd, void *d_, int > arg) > +{ > + dir_config_rec *d = d_; > + > + d->checkhandler = arg ? MODDIR_ON : MODDIR_OFF; > + return NULL; > +} > static const char *configure_redirect(cmd_parms *cmd, void *d_, const > char *arg1) > { > dir_config_rec *d = d_; > @@ -123,6 +131,8 @@ static const command_rec dir_cmds[] = > "a list of file names"), > AP_INIT_FLAG("DirectorySlash", configure_slash, NULL, DIR_CMD_PERMS, > "On or Off"), > + AP_INIT_FLAG("DirectoryCheckHandler", configure_checkhandler, NULL, > DIR_CMD_PERMS, > + "On or Off"), > AP_INIT_TAKE1("DirectoryIndexRedirect", configure_redirect, > NULL, DIR_CMD_PERMS, "On, Off, or a 3xx status code."), > > @@ -135,6 +145,7 @@ static void *create_dir_config(apr_pool_ > > new->index_names = NULL; > new->do_slash = MODDIR_UNSET; > + new->checkhandler = MODDIR_UNSET; > new->redirect_index = REDIRECT_UNSET; > return (void *) new; > } > @@ -148,6 +159,8 @@ static void *merge_dir_configs(apr_pool_ > new->index_names = add->index_names ? add->index_names : > base->index_names; > new->do_slash = > (add->do_slash == MODDIR_UNSET) ? base->do_slash : add->do_slash; > + new->checkhandler = > + (add->checkhandler == MODDIR_UNSET) ? base->checkhandler : > add->checkhandler; > new->redirect_index= > (add->redirect_index == REDIRECT_UNSET) ? base->redirect_index : > add->redirect_index; > new->dflt = add->dflt ? add->dflt : base->dflt; > @@ -260,6 +273,10 @@ static int fixup_dir(request_rec *r) > return HTTP_MOVED_PERMANENTLY; > } > > + if (d->checkhandler == MODDIR_ON && strcmp(r->handler, > DIR_MAGIC_TYPE)) { > + return DECLINED; > + } > + > if (d->index_names) { > names_ptr = (char **)d->index_names->elts; > num_names = d->index_names->nelts; > > > -- Born in Roswell... married an alien... http://emptyhammock.com/ --001a113470d2ee0e9a04f10be4ea Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On S= un, Jan 12, 2014 at 8:42 PM, <covener@apache.org> wrote:
Author: covener
Date: Mon Jan 13 01:42:12 2014
New Revision: 1557640

URL: http://sv= n.apache.org/r1557640
Log:
restore http://svn.apache.org/viewvc?view=3Drevision&= amp;revision=3D233369
under a configurable option: don't run mod_dir if r->handler is alre= ady set.

PR53794


Modified:
=A0 =A0 httpd/httpd/trunk/CHANGES
=A0 =A0 httpd/httpd/trunk/docs/manual/mod/mod_dir.xml
=A0 =A0 httpd/httpd/trunk/modules/mappers/mod_dir.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=3D1557640&a= mp;r1=3D1557639&r2=3D1557640&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Jan 13 01:42:12 2014
@@ -1,6 +1,10 @@
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 -*- coding: utf-8 -*-
=A0Changes with Apache 2.5.0

+
+ =A0*) mod_dir: Add DirectoryCheckHandler to allow a 2.2-like behavior, sk= ipping
+ =A0 =A0 execution when a handler is already set. PR53929. [Eric Covener]<= br> +
=A0 =A0*) mod_rewrite: Protect against looping with the [N] flag by enforci= ng a
=A0 =A0 =A0 default limit of 10000 iterations, and allowing each rule to ch= ange its
=A0 =A0 =A0 limit. [Eric Covener]

Modified: httpd/httpd/trunk/docs/manual/mod/mod_dir.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs= /manual/mod/mod_dir.xml?rev=3D1557640&r1=3D1557639&r2=3D1557640&= ;view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
--- httpd/httpd/trunk/docs/manual/mod/mod_dir.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_dir.xml Mon Jan 13 01:42:12 2014<= br> @@ -274,5 +274,31 @@ a directory</description>
=A0 =A0 =A0</highlight>
=A0</usage>
=A0</directivesynopsis>
+<directivesynopsis>
+<name>DirectoryCheckHandler</name>
+<description>Toggle how this module responds when another handler is= configured</description>
+<syntax>DirectoryCheckHandler On|Off</syntax>
+<default>DirectorySlash Off</default>
+<contextlist><context>server config</context><context= >virtual host</context>
+<context>directory</context><context>.htaccess</conte= xt></contextlist>
+<override>Indexes</override>
+<compatibility>Available in 2.4.8 and later. =A0Releases prior to 2.= 4 implicitly
+act as if "DirectorySlash Off" was specified.</compatibility&= gt;
+<usage>
+ =A0 =A0<p>The <directive>DirectoryCheckHandler</directive&= gt; directive determines
+ =A0 =A0whether <module>mod_dir</module> should check for dire= ctory indexes or
+ =A0 =A0add trailing slashes when some other handler has been configured f= or
+ =A0 =A0the current URL. =A0Handlers can be set by directives such as
+ =A0 =A0<directive module=3D"core">SetHandler</directiv= e> or by other modules,
+ =A0 =A0such as <module>mod_rewrite</module> during per-direct= ory substitutions.
+ =A0 =A0</p>
+
+ =A0 =A0<p> In releases prior to 2.4, this module did not take any a= ction if any
+ =A0 =A0other handler was configured for a URL. This allows directory inde= xes to
+ =A0 =A0be served even when a <directive>SetHandler</directive>= ; directive is
+ =A0 =A0specified for an entire directory, but it can also result in some = conflicts
+ =A0 =A0with modules such as <directive>mod_rewrite</directive>= ;.</p>
+</usage>
+</directivesynopsis>

At least on= e of the "DirectorySlash" occurrences is wrong. =A0(I guess both = are.)

I wonder if there is a more intuitive direct= ive name. =A0What about DirectoryOverrideHandler? =A0(with reversed sense o= f on/off) =A0Is that more obvious than DirectoryCheckHandler?



=A0</modulesynopsis>

Modified: httpd/httpd/trunk/modules/mappers/mod_dir.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/module= s/mappers/mod_dir.c?rev=3D1557640&r1=3D1557639&r2=3D1557640&vie= w=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
--- httpd/httpd/trunk/modules/mappers/mod_dir.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_dir.c Mon Jan 13 01:42:12 2014 @@ -44,6 +44,7 @@ typedef enum {
=A0typedef struct dir_config_struct {
=A0 =A0 =A0apr_array_header_t *index_names;
=A0 =A0 =A0moddir_cfg do_slash;
+ =A0 =A0moddir_cfg checkhandler;
=A0 =A0 =A0int redirect_index;
=A0 =A0 =A0const char *dflt;
=A0} dir_config_rec;
@@ -86,6 +87,13 @@ static const char *configure_slash(cmd_p
=A0 =A0 =A0d->do_slash =3D arg ? MODDIR_ON : MODDIR_OFF;
=A0 =A0 =A0return NULL;
=A0}
+static const char *configure_checkhandler(cmd_parms *cmd, void *d_, int ar= g)
+{
+ =A0 =A0dir_config_rec *d =3D d_;
+
+ =A0 =A0d->checkhandler =3D arg ? MODDIR_ON : MODDIR_OFF;
+ =A0 =A0return NULL;
+}
=A0static const char *configure_redirect(cmd_parms *cmd, void *d_, const ch= ar *arg1)
=A0{
=A0 =A0 =A0dir_config_rec *d =3D d_;
@@ -123,6 +131,8 @@ static const command_rec dir_cmds[] =3D
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"a list of file names"= ),
=A0 =A0 =A0AP_INIT_FLAG("DirectorySlash", configure_slash, NULL, = DIR_CMD_PERMS,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "On or Off"),
+ =A0 =A0AP_INIT_FLAG("DirectoryCheckHandler", configure_checkhan= dler, NULL, DIR_CMD_PERMS,
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "On or Off"),
=A0 =A0 =A0AP_INIT_TAKE1("DirectoryIndexRedirect", configure_redi= rect,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, DIR_CMD_PERMS, "On, Off,= or a 3xx status code."),

@@ -135,6 +145,7 @@ static void *create_dir_config(apr_pool_

=A0 =A0 =A0new->index_names =3D NULL;
=A0 =A0 =A0new->do_slash =3D MODDIR_UNSET;
+ =A0 =A0new->checkhandler =3D MODDIR_UNSET;
=A0 =A0 =A0new->redirect_index =3D REDIRECT_UNSET;
=A0 =A0 =A0return (void *) new;
=A0}
@@ -148,6 +159,8 @@ static void *merge_dir_configs(apr_pool_
=A0 =A0 =A0new->index_names =3D add->index_names ? add->index_name= s : base->index_names;
=A0 =A0 =A0new->do_slash =3D
=A0 =A0 =A0 =A0 =A0(add->do_slash =3D=3D MODDIR_UNSET) ? base->do_sla= sh : add->do_slash;
+ =A0 =A0new->checkhandler =3D
+ =A0 =A0 =A0 =A0(add->checkhandler =3D=3D MODDIR_UNSET) ? base->chec= khandler : add->checkhandler;
=A0 =A0 =A0new->redirect_index=3D
=A0 =A0 =A0 =A0 =A0(add->redirect_index =3D=3D REDIRECT_UNSET) ? base-&g= t;redirect_index : add->redirect_index;
=A0 =A0 =A0new->dflt =3D add->dflt ? add->dflt : base->dflt; @@ -260,6 +273,10 @@ static int fixup_dir(request_rec *r)
=A0 =A0 =A0 =A0 =A0return HTTP_MOVED_PERMANENTLY;
=A0 =A0 =A0}

+ =A0 =A0if (d->checkhandler =3D=3D MODDIR_ON && strcmp(r->ha= ndler, DIR_MAGIC_TYPE)) {
+ =A0 =A0 =A0 =A0return DECLINED;
+ =A0 =A0}
+
=A0 =A0 =A0if (d->index_names) {
=A0 =A0 =A0 =A0 =A0names_ptr =3D (char **)d->index_names->elts;
=A0 =A0 =A0 =A0 =A0num_names =3D d->index_names->nelts;





--
Born in Rosw= ell... married an alien...
http://emptyhammock.com/
--001a113470d2ee0e9a04f10be4ea--