lua-users home
lua-l archive

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


You are not using CGILua, but WSAPI, and a pretty old version at that
(your line numbers put you at version 1.1). You also did not tell:

* the name you gave your script (try giving it a .lua extension)
* what is the second web server

Also try the Kepler mailing list
(http://lists.luaforge.net/mailman/listinfo/kepler-project) to avoid
polluting the main Lua list.

--
Fabio Mascarenhas

On Fri, Sep 2, 2011 at 8:53 AM, Shaun savage <savages@mozapps.com> wrote:
> ubuntu 11.04
> apache     2.2.17
> lua    5.1.4-5
> cgilua    5.1.3
>
> It fails for me?
> If someone can tell me what is nil in both cases it would help.
> Or how to debug this
>
> shaun
>
>
> PROGRAM
> #!/usr/bin/env wsapi.cgi
>
> module(..., package.seeall)
>
> function hello(wsapi_env)
>  local headers = { ["Content-type"] = "text/html" }
>
>  local function hello_text()
>    coroutine.yield("<html><body>")
>    coroutine.yield("<p>Hello Wsapi!</p>")
>    coroutine.yield("<p>PATH_INFO: " .. wsapi_env.PATH_INFO .. "</p>")
>    coroutine.yield("<p>SCRIPT_NAME: " .. wsapi_env.SCRIPT_NAME .. "</p>")
>    coroutine.yield("</body></html>")
>  end
>
>  return 200, headers, coroutine.wrap(hello_text)
> end
>
> *** apache output
>
> There was an error in the specified application. The full error message
> follows:
>
> hw:3: bad argument #1 to 'module' (string expected, got nil)
> stack traceback:
>        [C]: in function 'module'
>        hw:3: in main chunk
>        [C]: in function 'dofile'
>        /usr/share/lua/5.1/wsapi/common.lua:312: in function 'load_wsapi'
>        /usr/bin/wsapi.cgi:21: in function
>        (tail call): ?
>        [C]: in function 'xpcall'
>        /usr/share/lua/5.1/wsapi/common.lua:147: in function 'run_app'
>        /usr/share/lua/5.1/wsapi/common.lua:171: in function 'run'
>        /usr/share/lua/5.1/wsapi/cgi.lua:18: in function 'run'
>        /usr/bin/wsapi.cgi:26: in main chunk
>        [C]: ?
>
>
> Other web server output
>
> There was an error in the specified application. The full error message
> follows:
>
> /usr/share/lua/5.1/wsapi/common.lua:189: bad argument #1 to 'match' (string expected, got nil)
> stack traceback:
>        [C]: in function 'match'
>        /usr/share/lua/5.1/wsapi/common.lua:189: in function 'splitext'
>        /usr/share/lua/5.1/wsapi/common.lua:204: in function
>        (tail call): ?
>        /usr/bin/wsapi.cgi:16: in function
>        (tail call): ?
>        [C]: in function 'xpcall'
>        /usr/share/lua/5.1/wsapi/common.lua:147: in function 'run_app'
>        /usr/share/lua/5.1/wsapi/common.lua:171: in function 'run'
>        /usr/share/lua/5.1/wsapi/cgi.lua:18: in function 'run'
>        /usr/bin/wsapi.cgi:26: in main chunk
>        [C]: ?
>
>
>