lua-users home
lua-l archive

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

On Nov 18, 2007, at 14:32, Humberto S. N. dos Anjos wrote:

Does anyone have any interesting candidates to spare?

Not sure how interesting it is, but here is a HTTP server, with supporting modules, in pure Lua:

No external dependencies aside from Lua itself and tcpserver [1].

Typical HelloWorld.lua example:

local HTTP = require( 'HTTP' )

HTTP[ '/hello(%a*)' ] = function( aName ) return 'Hello ' .. ( aName or 'world' ) end


Start HelloWorld.lua under tcpserver:

% tcpserver -oDHlR 0 1080 lua HelloWorld.lua

Benchmark it with ApacheBench:

% ab -n 1000 -k http://localhost:1080/hello
Requests per second:    1116.07 [#/sec] (mean)

Rinse and repeat.