Re: bug in URL::URL class

Gisle Aas (aas@bergen.sn.no)
Tue, 04 Jun 1996 12:24:38 +0200


In message <199606040721.IAA28347@pluto>, Nick Ing-Simmons writes:
> Marc Unangst <mju@cs.cmu.edu> writes:
> >If you create a URI::URL object for a URL with a fragment, and then
> >delete the fragment by calling frag(""), the stringified version of
> >the URL still contains a "#".  For example, this program:
> 
> That is "correct" IMHO.

IMHO too.  You will find the same behaviour for zero length query and
params too.

> Calling 
> 
>     $url->frag(undef);
> 
> Reads better (says what you are doing) and works:
> 
> perl -x /home/road17/nick/msgs/store/msgs.96.06/mju96Jun03.1615.71
> before: url->frag = foo
> before: url->abs = http://www.cs.cmu.edu/~mju/index.html#foo
> after : url->frag(undef)
> after : url->abs = http://www.cs.cmu.edu/~mju/index.html

This behaviour also makes it possible to "playback" URLs like these:

  http://host/foo#
  http://host/foo?
  http://host/foo?#

I don't know if zero length query strings and fragments have any
semantic meaning though.  Does the RFC say anything about this?

Regards,
Gisle.