chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Suggestion for new egg: Wings!


From: Alaric Snell-Pym
Subject: Re: [Chicken-users] Suggestion for new egg: Wings!
Date: Sat, 7 Jul 2007 18:43:18 +0100


On 6 Jul 2007, at 7:06 pm, Mario Domenech Goulart wrote:

On Fri, 6 Jul 2007 18:40:56 +0100 Alaric Snell-Pym <address@hidden
pym.org.uk> wrote:

Why's http:find-resource need hacking?

Because http:find-resource searches for resources using something like
equal?.

url-dispatcher needs some resource finder which looks for resources
from a given pathname -- like regex matching.

I see. The normal approach to URL->handler mapping is to find the
longest prefix match. If you have handlers registered for /foo, /bar,
and /bar/baz, then a request for /foo/fish would go to the foo
handler, /bar/wow to the /bar handler, and /bar/baz to the /bar/baz
handler (NOT the /bar handler, since it's a *longer* match)

Eg, if you own some prefix P, then you own all URLs starting with P
*unless* some of them have been explicitly granted to somebody else.

The 'extra' bit of URL after the prefix you have claimed is known as
"path info".

Eg, under Apache, if I put "foo/test.php" under my document root,
then I visit http://www.example.com/foo/test.php/a/b/c?x=y, then in
the PHP script, $_SERVER["PATH_INFO"] (or some such) will be bound to
"/a/b/c".

Which is useful in many and varied ways.

Shall I take a look inside http-server and see about implementing
such a prefix algorithm, or is the extra flexibility of regular
expressions warranted? It's Felix's egg - what would he be willing to
merge in? :-)


ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/?author=4






reply via email to

[Prev in Thread] Current Thread [Next in Thread]