httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Re: bug w/ ServerPath
Date Tue, 31 Dec 1996 05:05:29 GMT
+1 on this Alexei. Sorry I have missed it.


> I was just setting up a server with ServerPath, and I found a bug
> that, apparently, has gone unnoticed since its inception. The bug
> occurs (and I will use the actual site I found this on as an example)
> when, for example, you have "ServerPath /b5", and a file in that
> server named (for example) "b5title.gif". When a request comes in for
> that file, without the ServerPath element,
> e.g. http://b5.dal.net/b5title.gif, with a Host: header, the server
> decides that the "/b5" is the ServerPath part, and chops it off. It
> then tries to look for a file named "title.gif", and doesn't find it.
> 
> The fix is to make ServerPath (as we fixed with <Location> a few months
> ago) only match path segments. Here's a patch:
> 
> P.S. Outstanding is still my patch to make <Files> sections have the
> correct overrides. It's important. Should I send it again?
> 
> Index: http_core.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_core.c,v
> retrieving revision 1.53
> diff -c -r1.53 http_core.c
> *** http_core.c	1996/12/17 20:30:46	1.53
> --- http_core.c	1996/12/27 05:04:18
> ***************
> *** 1219,1225 ****
>       if ((r->uri[0] != '/') && strcmp(r->uri, "*")) return BAD_REQUEST;
>       
>       if (r->server->path &&
> ! 	!strncmp(r->uri, r->server->path, r->server->pathlen))
>         r->filename = pstrcat (r->pool, conf->document_root,
>   			     (r->uri + r->server->pathlen), NULL);
>       else
> --- 1224,1233 ----
>       if ((r->uri[0] != '/') && strcmp(r->uri, "*")) return BAD_REQUEST;
>       
>       if (r->server->path &&
> ! 	!strncmp(r->uri, r->server->path, r->server->pathlen) &&
> ! 	(r->server->path[r->server->pathlen - 1] == '/' ||
> ! 	 r->uri[r->server->pathlen] == '/' ||
> ! 	 r->uri[r->server->pathlen] == '\0'))
>         r->filename = pstrcat (r->pool, conf->document_root,
>   			     (r->uri + r->server->pathlen), NULL);
>       else
> Index: http_protocol.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_protocol.c,v
> retrieving revision 1.84
> diff -c -r1.84 http_protocol.c
> *** http_protocol.c	1996/12/17 20:52:12	1.84
> --- http_protocol.c	1996/12/27 05:05:01
> ***************
> *** 611,617 ****
>      */
>   
>     for (s = r->server->next; s; s = s->next) {
> !     if (s->path && !strncmp(r->uri, s->path, s->pathlen))
>         r->server = r->connection->server = s;
>     }
>   }
> --- 611,620 ----
>      */
>   
>     for (s = r->server->next; s; s = s->next) {
> !     if (s->path && !strncmp(r->uri, s->path, s->pathlen) &&
> ! 	(s->path[s->pathlen - 1] == '/' ||
> ! 	 r->uri[s->pathlen] == '/' ||
> ! 	 r->uri[s->pathlen] == '\0'))
>         r->server = r->connection->server = s;
>     }
>   }
> 
> 
> -- 
> ________________________________________________________________________
> Alexei Kosut <akosut@nueva.pvt.k12.ca.us>      The Apache HTTP Server
> URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/




Mime
View raw message