httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <dgaudet-list-new-ht...@arctic.org>
Subject unescaping hell (was Re: cvs commit: apache-1.3/src/main http_vhost.c)
Date Fri, 23 Feb 2001 20:57:53 GMT
sorry guys i must have missed the warning in my commit... and i didn't
realise you were nearing a release.

unfortunately my commit, and the one below are both wrong -- they
mishandle a request such as "GET http://abc%3Adef:8080/foo HTTP/1.0"

%3A is : ... and the use of %3A there gives a hostname of "abc:def" and a
port of 8080.  (the unescapes occur after all the "metacharacters" such as
@, :, /, ? are parsed.)

i'd suggest dropping the change entirely in favour of a more correct fix
(which could slip into a later release).

in particular, when i asked roy about this, he indicated that the %
escapes will become more common as DNS i18n occurs.  it would be
worthwhile to find out how exactly DNS i18n will work and see if we're
ready for it.

here's my suggestions:

- undo the fix_hostname() changes
- add scheme, user, password, hostname, and port unescaping to
  ap_parse_uri_components
- move the ap_unescape_url() calls for the path into
  ap_parse_uri_components
- add hostname and port unescaping to ap_parse_hostinfo_components
- leave query_string escaped -- it would break too many things if we
  attempted to unescape it (i.e. you'd have to change the query_string
  support to be a list of values, otherwise you'd have trouble handling
  query_strings such as "/foo?abc%26def=bar&blah=blat"  ... %26 = &)
- i don't know what to do about fragment, i suspect leaving it
  escaped is right as well

any volunteers?

-dean

On Tue, 20 Feb 2001, Greg Stein wrote:

> Strictly not needed since we replace r->hostname at the end of the function,
> but it certainly doesn't hurt either.
>
> Thanks for making the change! :-)
>
> Cheers,
> -g
>
> On Wed, Feb 21, 2001 at 12:58:59AM -0000, wrowe@apache.org wrote:
> > wrowe       01/02/20 16:58:58
> >
> >   Modified:    src/main http_vhost.c
> >   Log:
> >     Whoops ... have a new string, and forgot to remember it.
> >
> >   Revision  Changes    Path
> >   1.29      +1 -0      apache-1.3/src/main/http_vhost.c
> >
> >   Index: http_vhost.c
> >   ===================================================================
> >   RCS file: /home/cvs/apache-1.3/src/main/http_vhost.c,v
> >   retrieving revision 1.28
> >   retrieving revision 1.29
> >   diff -u -r1.28 -r1.29
> >   --- http_vhost.c	2001/02/21 00:36:37	1.28
> >   +++ http_vhost.c	2001/02/21 00:58:56	1.29
> >   @@ -708,6 +708,7 @@
> >
> >        /* check and copy the host part */
> >        src = ap_pstrdup(r->pool, r->hostname);
> >   +    r->hostname = src;
> >        /* unescape the hostname first */
> >        if (ap_unescape_url(src) != OK) {
> >    	goto bad;
> >
> >
> >
>
> --
> Greg Stein, http://www.lyra.org/
>



Mime
View raw message