[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Xavante/Cgilua: custom handler - please critique
- From: Javier Guerra <javier@...>
- Date: Sun, 14 Aug 2005 18:52:59 -0500
On Sunday 14 August 2005 2:33 pm, William Trenker wrote:
> How would you write a Xavante/config.lua simplerule to direct
> everything to a single cgilua script? Something like:
i think i understand a bit of what you're trying to do; you want a CGILua
launcher that doesn't use the requested URL to choose the script to run.
instead, you want it to always answer with the 'login' system.
you were right: the stock CGILua launcher can't do that.
but i think there's an easier way to get the same effect:
function loginHandler (req, res)
if not logged() then
req.headers ["orig_url"] = req.relpath
req.relpath = "login/login.lua"
return cgiluaHandler (req, res)
else
-- redirect to the 'real' servers
end
end
this way, you just modify the request and let the standard CGILua handle it
i have some ideas (no code yet) to move quite a bit of Xavante core
functionality to handlers; i think it'll let the users reorder the request
process in very flexible ways, especially around the URL parsing steps
but right now i'm writing a framework to vastly simplify writing handlers; in
some cases to one-liners... wish me luck!
--
Javier
Attachment:
pgp7qeWrHIt9s.pgp
Description: PGP signature