develooper Front page | perl.fwp | Postings from April 2003

Re: Resolving unterminated URL paths

Thread Previous | Thread Next
From:
peter
Date:
April 11, 2003 07:59
Subject:
Re: Resolving unterminated URL paths
Message ID:
20030411142845.14179.qmail@onion.perl.org
In article <20030410130228.12299.qmail@onion.perl.org>,
 rob@dixon.nildram.co.uk (Rob Dixon) writes:
>Hi all.
>
>Can somebody suggest how I might resolve the following?
>
>If I make a GET request to a server with a URL like
>
>    http::/ww.domain.com/path/path/name
>
>how can I determine whether what is passed back is actually
>this path (i.e. 'name' is a resource) or if what I am getting is
>really
>
>    http::/ww.domain.com/path/path/name/default.htm
>
>or the equivalent?
>
>The reason I ask is that this clearly has a bearing on relative
>links within the data returned. Are they relative to
>
>    http::/ww.domain.com/path/path/name/
>or to
>    http::/ww.domain.com/path/path/

Strange sort of URLs you have there.  Mine have two / and one :, not
the other way around.

If http://foo.com/path is a directory, the server generally sends back
a 302 redirect to http://foo.com/path/ or http://foo.com/path/index.html
or the like.  So either do a simple_request or check the redirect chain
in the response.

Of course, the server is free to play with your head if it wants to.

-- 
Peter Scott
http://www.perldebugged.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About