You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ics.uci.edu> on 1998/02/21 04:36:32 UTC
Re: cvs commit: apache-1.3/src/main http_protocol.c
> 1.190 +10 -4 apache-1.3/src/main/http_protocol.c
>
> Index: http_protocol.c
> ===================================================================
> RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
> retrieving revision 1.189
> retrieving revision 1.190
> diff -u -r1.189 -r1.190
> --- http_protocol.c 1998/02/18 11:59:20 1.189
> +++ http_protocol.c 1998/02/21 01:18:28 1.190
> @@ -628,6 +628,7 @@
> char *host, *proto, *slash, *colon;
> int plen;
> unsigned port;
> + const char *res_uri;
>
> /* This routine parses full URLs, if they match the server */
> proto = http_method(r);
> @@ -664,15 +665,20 @@
> return uri;
>
> /* Save it for later use */
> - r->hostname = pstrdup(r->pool, host);
> + r->hostname = host;
> r->hostlen = plen + 3 + slash - host;
> + res_uri = uri + r->hostlen;
> + /* deal with "http://host" */
> + if (*res_uri == '\0') {
> + res_uri = "/";
> + }
Ummm, that can't be right. I'm not sure what it is doing, but I'm
pretty sure it isn't doing anything good. But I can't find my C hat
at the moment.
....Roy
Re: cvs commit: apache-1.3/src/main http_protocol.c
Posted by Dean Gaudet <dg...@arctic.org>.
On Fri, 20 Feb 1998, Roy T. Fielding wrote:
> > 1.190 +10 -4 apache-1.3/src/main/http_protocol.c
> >
> > Index: http_protocol.c
> > ===================================================================
> > RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
> > retrieving revision 1.189
> > retrieving revision 1.190
> > diff -u -r1.189 -r1.190
> > --- http_protocol.c 1998/02/18 11:59:20 1.189
> > +++ http_protocol.c 1998/02/21 01:18:28 1.190
> > @@ -628,6 +628,7 @@
> > char *host, *proto, *slash, *colon;
> > int plen;
> > unsigned port;
> > + const char *res_uri;
> >
> > /* This routine parses full URLs, if they match the server */
> > proto = http_method(r);
> > @@ -664,15 +665,20 @@
> > return uri;
> >
> > /* Save it for later use */
> > - r->hostname = pstrdup(r->pool, host);
> > + r->hostname = host;
> > r->hostlen = plen + 3 + slash - host;
> > + res_uri = uri + r->hostlen;
> > + /* deal with "http://host" */
> > + if (*res_uri == '\0') {
> > + res_uri = "/";
> > + }
>
> Ummm, that can't be right. I'm not sure what it is doing, but I'm
> pretty sure it isn't doing anything good. But I can't find my C hat
> at the moment.
Which? The return value of check_fulluri() is a const char *, "/" is a
valid const char *. parse_uri, which is called next, goes ahead and
strdups it.
Or are you complaining about r->hostlen = plen + 3 + slash - host? That's
an int + int + ptrdiff_t ... which is valid too.
Take a look at the patch in the context of the entire routine. I mean
I'll completely admit that check_fulluri() is broken, and I really want to
fix it. But it's non-trivial given the lame semantics of absoluteURIs...
which I'll complain about in another message.
Dean