[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaWebserver [was: a few questions re LuaSockets]
- From: "Martin Spernau" <martin@...>
- Date: Fri, 24 Jan 2003 01:26:09 +0100
Just some very quick pointers re sandboxes before I leave for the weekend:
----- Original Message -----
From: "Joe Stewart" <email@example.com>
To: "Multiple recipients of list" <firstname.lastname@example.org>
Sent: Thursday, January 23, 2003 10:28 PM
Subject: Re: LuaWebserver [was: a few questions re LuaSockets]
> At 10:01 PM 1/23/2003, you wrote:
> >From: "Joe Stewart" <email@example.com>
> > > I put the files on http://lua-users.org in users/jstewart/*, but
> > > figure out how to properly point your page to the files... any
> >I think the way they are linked now is ok.
> Only after a bit of mucking around!
> >I've only had a short look at the code yet, so I can't say too much. One
> >thing I noticed was that you popen() .lua files to run scripts.
> Ugly, huh?
> >Maybe that could be done more directly via dofile() or such... I don't
> >the details now, but a while back I saw some nice code to 'sandbox'
> >Lua code inside another script...
> This is exactly why I used popen... I didn't want errant scripts to
> the server. If you can point me to the "sandbox" code, I'll see if I can
> integrate the concepts...
> I was wondering if it was possible from standard lua to set the global
> environment to another table prior to a dofile(), then kill the temp one
> and restore the main?
> I guess the called script could be entirely contained in a well-known
> function (perhaps 'main()') with all parameters as functions and all its
> variables as locals. Does this make sense? How would you trap errors
> without killing the calling script?
> >I will try and look into this after the weekend when I find some time
> > >From my own experiments with libwebserver, I'm now more and more
> >that doing the main loop in Lua would be my goal, if only for
> >In the long run I'd also like to try using coroutines for handling more
> >one request at a time.
> Are co-routines possible with Lua 4? I'm a bit hesitant to move to Lua
> no reason other than I only use what I can build (I compile with lcc-win32
> among other compiles/environments) and I haven't taken the time to try and
> compile Lua 5.
> My approach of using 'readfrom("|lua ...")' while fat and ugly, does
> provide an opportunity for multiple requests, since I could read one line
> of output from the script, go to the next, etc., but even with this,
> coroutines would make for an overall better looking piece of code IMHO,
> considering the state information you'd probably have to carry around.
> Did anyone ever respond about using luasocket's 'select' with lua's file
> handles rather than sockets? Under *NIX at least, this ~could~ work, I'm
> not too sure about Windows (and I want to support both)... I guess I can
> answer this myself by looking at the source... ;-).
> >This would esp. be important if dealing not with
> >static content (which is more-or-less piping a file to stdout) but with
> >dynamically generated content that might take more time to generate.
> Do you know how dynamic content is handled via http? Is there something
> more than GET/POST/PUT that I need to know about (too impatient to read
> RFCs)? Any pointers?
> >Thanks for all the contributions and suggestions,
> I've received more than I've given ;-). Thanks to all!