On Sun, Feb 14, 2010 at 11:39:18AM -0500, Taylor Venable wrote: > The Spiffy documentation says about the value of handle-not-found: "It > is a procedure of one argument, the path (a string) that was requested." > However, it seems that the actual argument is the path, up until the > first component which was not found. If root-path does not exist, path > is always "/". If root-path does exist, but neither "foo" nor "asdf" > exist within it, then path is always "/foo" or "/asdf". That's what it > seems to be, anyway; is that the correct behaviour?
Good question, I'm not 100% sure myself :) The idea here would be that the not-found handler should indeed be able to handle whatever part of the path was not found, so this information is very useful but missing. If nobody objects, I could change the handler to pass the remaining path to (handle-not-found) as a second argument. Unfortunately this would be a backwards-incompatible change, though. This would be a list of remaining path components. > It seems to be slightly different from what the documentation says, > since it is not necessarily the requested path. Yeah, if nothing else it's surely a documentation bug. > In the meantime I've been using this code as a workaround to get what I > want regardless of the existence of files in the path: > > (string-join (cdr (uri-path (request-uri (current-request)))) "/" 'prefix) Yeah, this workaround should more or less work. There's one caveat: By doing it this way, encoded slashes will be indistinguishable from path-separating slashes. Recently there have been a few new eggs created for dispatching URIs. You might find those interesting: http://chicken.wiki.br/eggref/4/spiffy-uri-match (or more generally http://chicken.wiki.br/eggref/4/uri-match ) http://chicken.wiki.br/eggref/4/uri-dispatch and a more generic web framework was created as well: http://chicken.wiki.br/eggref/4/awful If you prefer simplicity, you could also use Andrew Wright's pattern matcher on the uri-path: http://chicken.wiki.br/eggref/4/matchable Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users