lua-users home
lua-l archive

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


On Tue, Jan 21, 2003 at 03:48:44PM +0100, Martin Spernau wrote:

> * has anybody tried/succeded in building a HTTP server in Lua? One that 
> can process multiple connections/requests simultaneouly?
> I'd be very intersted in pointers, ideas etc.

My most recent big project in Lua was a talker server that uses
non-blocking TCP sockets to multiplex output.  It works a treat.  I've
done HTTP servers before in Lua, but they were very primitive.

> * I've looked at several minimal/small-footprint webservers in C, and 
> would like to try to build something similar in Lua. Ideas anybody?

One problem you might come across is the want to use stat() or similar
(ie, to get date stamps for files so you can put the last modified
header in, and respond to if-modified-since requests).  There isn't a
stat() like thing in ANSI C AFAIK, so you may have do some work in the C
domain anyway, perhaps quite a lot to get acceptable performance.  You
may also run into the problem that you can't select() on normal Lua file 
handles (I think) which would be great for this, too.  Perhaps also a
little sendfile() magic?

-- 
Rob Kendrick                                       http://www.pepperfish.net/
PGP signed or encrypted mail welcome                         Key ID: 3651D17A