You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@algroup.co.uk> on 2001/12/08 17:53:38 UTC

Magic in request.c

This patch removes some magic in request.c. I wrote it coz 2.0.28 didn't
actually work at all for me, coz the magic failed.

Somehow the magic was OK again in the snapshot I tried, but I consider
it a bad thing that it exists at all (btw, the whole directory walk I
find completely unreadable, I ought to do something about it).

What do people think?

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Re: Magic in request.c

Posted by Bill Stoddard <bi...@wstoddard.com>.
(btw, the whole directory walk I find completely unreadable, I ought to do something about
it).

+1, readability is a good thing.

Bill


Re: Magic in request.c

Posted by Brian Pane <bp...@pacbell.net>.
Ben Laurie wrote:

>This patch removes some magic in request.c. I wrote it coz 2.0.28 didn't
>actually work at all for me, coz the magic failed.
>

+1; this patch is a lot less cryptic than the current logic

>Somehow the magic was OK again in the snapshot I tried, but I consider
>it a bad thing that it exists at all (btw, the whole directory walk I
>find completely unreadable, I ought to do something about it).
>

IMHO, making directory_walk more readable sounds like a good idea,
assuming that it doesn't get any slower as a result.

--Brian



Re: Magic in request.c

Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
> This patch removes some magic in request.c. I wrote it coz 2.0.28 didn't
> actually work at all for me, coz the magic failed.

++1.  Clarity doesn't have to be inconsistent with optimization.

In my defense, what existing before was even less legible - I sincerely
tryed to improve it before the last set of optimizations were applied
(both mine and Brian's.)

> --
> http://www.apache-ssl.org/ben.html       http://www.thebunker.net/
> 
> "There is no limit to what a man can do or how far he can go if he
> doesn't mind who gets the credit." - Robert Woodruff


--------------------------------------------------------------------------------


> --- request.c~ Fri Nov  9 16:54:00 2001
> +++ request.c Sun Dec  2 14:36:48 2001
> @@ -618,12 +618,14 @@
>              int res;
>              char *seg_name;
>              char *delim;
> +     int temp_slash=0;
>          
>              /* We have no trailing slash, but we sure would appreciate one...
>               */
>              if (sec_idx && r->filename[filename_len-1] != '/') {
>                  r->filename[filename_len++] = '/';
>                  r->filename[filename_len] = 0;
> + temp_slash=1;
>              }
>  
>              /* Begin *this* level by looking for matching <Directory> sections
> @@ -791,7 +793,7 @@
>  
>              /* That temporary trailing slash was useful, now drop it.
>               */
> -            if (seg > startseg) {
> +            if (temp_slash) {
>                  r->filename[--filename_len] = '\0';
>              }
>  
>