lua-users home
lua-l archive

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


On Tuesday 11 January 2005 8:33 pm, Joseph Stewart wrote:
> I also have been working on a lua httpd!

i'm sure it's a common wish... in fact i was surprised not to find dozens of 
these!

> Mine lacks the elegance of yours, but I'm trying to implement mine

(elegance? have you read the code?)

> strictly with coroutines, where a socket send or receive will yield
> the thread to a scheduler that's heart is a select statement (blocking
> on the very sends/receives in each thread).

i tried to do it with coroutines too (more lightweight), but luaSocket doesn't 
seem to have a truly nonblocking mode.  and i do like it's 'line mode'.

also, even if i think most of the queries could be answered quickly, some of 
them could try to use other blocking libraries (SQL?).  it wouldn't be nice 
to make all queries wait on one.

> Lua scripts started from the server would be sandboxed to prevent
> crashing/hanging where possible, and provided a send() and receive()
> function that "plays nice" with the scheduler.

i'm not fond of sandboxes... and it shows in my code, it's still too easy to 
break the whole thing.

> My code is monsterously nasty right now, but I'm hoping I can borrow
> (steal) some ideas in your code and release it when it looks better.

sure... if your send() and receive() functions play nice enough, i'd like to 
do a coroutine based server, and let a handler to fork a thread if it needs 
to use blocking libraries

-- 
Javier

Attachment: pgp4bfa5c2iYX.pgp
Description: PGP signature