lua-users home
lua-l archive

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

On 8/14/05, Javier Guerra <> wrote:
> 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.

That would probably work fine.  Perhaps it could be a second parameter
to cgiluahandler.lua that, if present, provides the name of the script
which will be launched for any rules that the handler is responsible

Here's another, related, idea.  How about exposing the rules-setting
code as part of the Xavante API?  In other word, how about being able
to add / change / delete rules on the fly.  Then a master script could
change the rules depending on certain input conditions and other
factors that change dynamically.

> 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

I've tried out something like this and it definitely has merit.  I'll
keep experimenting.

> 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

And, If I may be so bold, to move some of the CGILua core into the
Xavante handler API.  In my original post, I exposed CGILua's 
getparams() function so that I could parse the request's CGI data
inside a Xavante handler.  That way, I could use the GET / POST data
as part of the decision making at the Xavante handler level.  (Here's
another way of looking at what I'm trying to implement: I see a master
script as a dispatcher with several, small .lp CGILua scripts as user
input forms.  The master script coordinates everything including using
CGILua sessions for state (and maybe even an sqlite database for
long-term data).  The master script is the brains and the .lp scripts
are just for html forms as a simple GUI for user input.  In otherwords
I don't envision using any .lua CGI scripts for coding, just this
single master script.)

> but right now i'm writing a framework to vastly simplify writing handlers; in some cases to one-liners... wish me luck!

You don't need luck.  You are very skilled and your skill will make
this happen.  Thanks, Javier, for all the effort and time you've put
into Xavante.