You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2008/11/12 21:02:33 UTC

Re: svn commit: r713462 - in /httpd/httpd/trunk: docs/manual/mod/mod_dir.html.en docs/manual/mod/mod_dir.xml docs/manual/mod/mod_dir.xml.meta modules/mappers/mod_dir.c


On 11/12/2008 08:25 PM, covener@apache.org wrote:
> Author: covener
> Date: Wed Nov 12 11:25:03 2008
> New Revision: 713462
> 
> URL: http://svn.apache.org/viewvc?rev=713462&view=rev
> Log:
> change short-lived behavior of "DirectoryIndex None" based on feedback from wrowe:
> 
> Doesn't search for anything:
>   DirectoryIndex disabled
> 
> Does search for literal "disabled":
>   DirectoryIndex disabled foo.
>   DirectoryIndex foo disabled 
>   DirectoryIndex disabled disabled 
> 
> Does search:
>   DirectoryIndex disabled.html
> 
> 
> Modified:
>     httpd/httpd/trunk/docs/manual/mod/mod_dir.html.en
>     httpd/httpd/trunk/docs/manual/mod/mod_dir.xml
>     httpd/httpd/trunk/docs/manual/mod/mod_dir.xml.meta
>     httpd/httpd/trunk/modules/mappers/mod_dir.c
> 

> Modified: httpd/httpd/trunk/modules/mappers/mod_dir.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_dir.c?rev=713462&r1=713461&r2=713462&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_dir.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_dir.c Wed Nov 12 11:25:03 2008
> @@ -47,13 +47,30 @@
>  static const char *add_index(cmd_parms *cmd, void *dummy, const char *arg)
>  {
>      dir_config_rec *d = dummy;
> -
> +    const char *t, *w;
> +    int count = 0;
> +   
>      if (!d->index_names) {
>          d->index_names = apr_array_make(cmd->pool, 2, sizeof(char *));
>      }
> -    if (strcasecmp(arg, "none")) { 
> -        *(const char **)apr_array_push(d->index_names) = arg;
> +
> +    t = arg;
> +    while ((w = ap_getword_conf(cmd->pool, &t)) && w[0]) { 
> +        if (count == 0 && !strcasecmp(w, "disabled")) { 
> +            /* peek to see if "disabled" is first in a series of arguments */
> +            const char *tt = t;
> +            fprintf(stderr, "t:'%s'\n", t);

I guess you forgot to remove this, correct?

> +            const char *ww = ap_getword_conf(cmd->pool, &tt);

Doesn't this mean that we lose the second argument if disabled is the first?
The second argument is stored in ww in this case and the the checking of the while
condition will let us advance to the third argument, correct?

> +            if (ww == NULL || !ww[0]) { 
> +               /* "disabled" is first, and alone */
> +                
> +               continue;

Why continue and not break? We already now that there is only one argument.
Where is the point in testing the while condition again?

> +            }
> +        }
> +        *(const char **)apr_array_push(d->index_names) = w;
> +        count++;
>      }
> +
>      return NULL;
>  }
>  

Regards

RĂ¼diger

Re: svn commit: r713462 - in /httpd/httpd/trunk: docs/manual/mod/mod_dir.html.en docs/manual/mod/mod_dir.xml docs/manual/mod/mod_dir.xml.meta modules/mappers/mod_dir.c

Posted by Eric Covener <co...@gmail.com>.
>> +            fprintf(stderr, "t:'%s'\n", t);
>
> I guess you forgot to remove this, correct?

yes,  didn't scrutinize properly when I picked the patch back up

>
>> +            const char *ww = ap_getword_conf(cmd->pool, &tt);
>
> Doesn't this mean that we lose the second argument if disabled is the first?
> The second argument is stored in ww in this case and the the checking of the while
> condition will let us advance to the third argument, correct?

only the short-lived "tt" is getting advanced, so the second arg is
still available in the while loop based on "t"

>
>> +            if (ww == NULL || !ww[0]) {
>> +               /* "disabled" is first, and alone */
>> +
>> +               continue;
>
> Why continue and not break? We already now that there is only one argument.
> Where is the point in testing the while condition again?
>

true; thanks

-- 
Eric Covener
covener@gmail.com