lua-users home
lua-l archive

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




* 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

I think I've found a very good candidate for doinbg the server part in C:
libwebserver (http://libwebserver.sourceforge.net/)

I will try to 'embed' this into Lua, as the setting-up of a 'server' is really very simple:
* init the server (port, logfile)
* register 'handler' function for URL shemes (this is where Lua would come in)
* run the server

The docu,mentation in the tar isclear with good examples,
and most importantly for me, the project builds out-of-the-box on windows (vc6) and linux.

If there is interst I'll post my progress,

-Martin