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

Re: Resolving unterminated URL paths

April 11, 2003 01:39
Re: Resolving unterminated URL paths
Message ID:
On Thu, Apr 10, 2003 at 02:02:26PM +0100, Rob Dixon wrote:
> 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::/
> 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::/
> or the equivalent?

Most servers will in their default configuration not give the same
response for requests to "" and
"". For the former,
a 402 or 403 response code (Moved) will be given, with the location

From the POV of URLs, "" and
"" are different,
even if they server the same content. There is a very important
thing to remember:

    URLs do *NOT* map to files.

I repeat,

    URLs do *NOT* map to files.

Now, your server might decide that a request for
"" gets the some content
as a request for "",
but that's server policy, and has nothing to do with URLs.

> The reason I ask is that this clearly has a bearing on relative
> links within the data returned. Are they relative to
>     http::/
> or to
>     http::/

If you do a request for "",
a relative URL is relative to "".
If you do a request for "", a relative
URL is relative to "".

It so happens that URLs relative to
"" map to the same
absolute URLs as URLs relative to
"", URLs relative to
"", and also URLs relative to
"". This is because the final
component, whether the empty string or not, play no role in resolving
relative URLs.

Abigail Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About