lua-users home
lua-l archive

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


Hi list,

I'd like to write a simple application running on a webserver. It
would be run by Apache as a cgi script. Its output would naturally be
redirected to the browser that triggered the cgi execution, and I'd
like to access the http request information easily (headers, GET/POST
information).

I've had a look at Kepler, CGILua and WSAPI, but none of them explains
how to run simple Lua cgi applications from Apache.

Of course I can simply tell Apache to run my Lua script as a cgi, but
then I'd have to learn the cgi specification and parse myself the
information provided by Apache (as environments variables iirc).

Can someone tell me how to configure WSAPI, CGILua, Kepler or maybe
another Lua CGI library to do that ? Ideally I would just drop a cgi
looking like the following along with some modules on my webserver:

#!/usr/bin/env lua
require 'cgi'
io.write("Content-type: text/plain\r\n\r\n")
local filename = assert(cgi.GET.filename, "no filename specified")
local file = assert(io.open(filename))
local content = assert(file:read"*a")
io.write(content)


--
Doub