Re: URI::URL->abs bug? (libwww-Perl5)

Randal Schwartz (merlyn@stonehenge.com)
15 Jul 1997 03:41:54 -0700


>>>>> "Boris" == Boris Statnikov <boris@hops.cs.jhu.edu> writes:

Boris> However, this will break:

Boris> $fullUlr = new URI::URL('../../../',
Boris> 'http://www.ugrad.cs.jhu.edu/~boris')->abs;
Boris> print $fullUrl;

Boris> producing 'http://www.ugrad.cs.jhu.edu/../../'

Well, one minor flaw... you have the wrong base URL.
You *definitely* would never have X/~boris as a page, unless
you happen to have a file named ~boris somewhere.

More likely, the base URL should be X/~boris/ (note trailing slash)
which your server would have redirected you to immediately when you
asked for the first.

And yes, this *does* make a difference on relative URLs, and it's *why*
the server issues a redirect.

There is *no* page named X/~boris !!!

However, I'm still mixed about where ../.. should really abs to,
because I think any sane web-server will give you back a redirect to
the real page.  (Didn't try this though...)  Maybe the relative URL is
illegal, and how URI::URL responds to illegal combos is probably
undefined, although if it's illegal, it should give a useful
result. :-)

Ahh.. just tried it with Apache 1.1, and it gave me a 400 error.

So there'd be no chance that a 'bot could get lost... it'd die on the
absolute URL.

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services
(503)777-0095 Keywords: Perl training, UNIX[tm] consulting, video
production, skiing, flying Email: <merlyn@stonehenge.com> Snail:
(Call) PGP-Key: (finger merlyn@ora.com) Web: <A
HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A> Quote: "I'm
telling you, if I could have five lines in my .sig, I would!" -- me