Requesting some assistance from this group's guru's, I know someone knows the 
answer.  I looked through the posts with no luck, except for a gentlemen (Asko 
Kauppi) in October 2007 having the same exact problem.  Please advise on what I 
should do, thanks so much in advance!

Xavante seems to be working quite well, as long as I comment out the cookie 
test code in the 'test.lp' that accompanies CGILua.  When leaving the cookie 
code in, here's what I get:

Cookies test

Here you should see the values posted before the ones shown above

cookie_kepler = /share/cgilua/cookies.lua:20: attempt to index global 'SAPI' (a 
nil value)
stack traceback:
  /share/cgilua/cookies.lua:20: in function 'servervariable'
  /share/cgilua/cookies.lua:82: in function 'get'
  test.lp:96: in function 'prog'
  /share/cgilua/lp.lua:133: in function 'include'
  /share/cgilua.lua:282: in function 
  (...tail calls...)
stack traceback:
  /share/cgilua.lua:161: in function 'err'
  /share/coxpcall.lua:24: in function 
  (...tail calls...)
  /share/cgilua.lua:169: in function 'pcall'
  /share/cgilua.lua:630: in function 'main'
  /share/wsapi/sapi.lua:53: in function 
  (...tail calls...)



It seems SAPI is not instantiated anywhere:

----------------------------------------------------------------------------
-- Cookies Library
--
-- @release $Id: cookies.lua,v 1.8 2008/04/24 13:42:04 mascarenhas Exp $
----------------------------------------------------------------------------

require"cgilua.urlcode"

local error = error
local format, gsub, strfind = string.format, string.gsub, string.find
local date = os.date
local escape, unescape = cgilua.urlcode.escape, cgilua.urlcode.unescape
local function header(...)
   return SAPI.Response.header(...)
end
local function write(...)
   return SAPI.Response.write(...)
end
local function servervariable(...)
   return SAPI.Request.servervariable(...)
end


My launch script is the following:

 -- webserver.lua

require("xavante")
require "xavante.filehandler"
require "xavante.cgiluahandler"
require "xavante.redirecthandler"

-- Define here where Xavante HTTP documents scripts are located

XAVANTE_WEB = "./webdir/"
local webDir = XAVANTE_WEB

local simplerules = {

  { -- URI remapping example
    match = "^[^%./]*/$",
    with = xavante.redirecthandler,
    params = {"index.lp"}
  }, 

  { -- cgiluahandler example
    match = {"%.lp$", "%.lp/.*$", "%.lua$", "%.lua/.*$" },
    with = xavante.cgiluahandler.makeHandler (webDir)
  },
    
  { -- filehandler example
    match = ".",
    with = xavante.filehandler,
    params = {baseDir = webDir}
  },
} 

xavante.HTTP{
  server = {host = "*", port = 8080},
    
  defaultHost = {
    rules = simplerules
  },
}

xavante.start()



Tom Skwara


_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to