Re: LWP 5.00 : GET a root document without specifying its
Elizabeth Mattijsen (liz@xxlink.nl)
Thu, 20 Jun 1996 11:49:29 +0100
At 08:19 20/06/96 +0200, Hans de Graaff wrote:
>if ($main::starturl !~ m|/$|) {
> $main::starturl = new URI::URL $main::opt_u . '/'
> unless $main::starturl =~ m|/[^/]+\.[^/]+$|;
>}
>(If the url doesn't end in a slash, add one, but only if we can't find
>an extension in the path component)
That may not be a good idea.
Many servers have scripts without extension in the URL. Adding a
slash at the end when requesting the URL, will produce the HTML-output
of the script. BUT, all relative references to e.g. images in that
script will break because the browser will glue the relative references
to the end of the URL. Example:
Suppose you do:
GET http://www.server.nl/cgi-bin/script
which contains
<A HREF=picture.gif>
then the URL of the picture becomes:
http://www.server.nl/form/picture.gif
Suppose you do:
GET http://www.server.nl/cgi-bin/script/
which contains
<A HREF=picture.gif>
then the URL of the picture becomes:
http://www.server.nl/cgi-bin/script/picture.gif
^^^^^^^
which was clearly not intended.
I don't have a clear solution, other than maybe not add a / if
there is a "cgi-bin" in the URI.
Elizabeth Mattijsen
xxLINK Internet Services