0
N ˆl–ßi~”ji?u @†àq·”Å£�þ[hm,Ùdx
×##ÀþÂ
„\qïÁa–Ü4ý( ©¤ýÔâ€
ÆY¸ÐTÅ£À ?÷ ----------------------------------------------------------------------------
-- CGILua library.
--
-- @release $Id: cgilua.lua,v 1.85 2009/06/28 22:42:34 tomas Exp $
----------------------------------------------------------------------------
local _G = assert(_G)
local urlcode = require"cgilua.urlcode"
local lp = require"cgilua.lp"
local lfs = require"lfs"
local debug = require"debug"
local assert, error, ipairs, select, tostring, type, unpack, xpcall = assert, error, ipairs, select, tostring, type, unpack, xpcall
local pairs = pairs
local gsub, format, strfind, strlower, strsub, match = string.gsub, string.format, string.find, string.lower, string.sub, string.match
local setmetatable = setmetatable
local _open = io.open
local tinsert, tremove, concat = table.insert, table.remove, table.concat
local date = os.date
local os_tmpname = os.tmpname
local getenv = os.getenv
local remove = os.remove
local seeall = package.seeall
lp.setoutfunc ("cgilua.put")
lp.setcompatmode (true)
local M = {
_COPYRIGHT = "Copyright (C) 2003-2013 Kepler Project",
_DESCRIPTION = "CGILua is a tool for creating dynamic Web pages and manipulating input data from forms",
_VERSION = "CGILua 5.2",
}
--
-- Internal state variables.
local SAPI
local _default_errorhandler = debug.traceback
local _errorhandler = _default_errorhandler
local _default_erroroutput = function (msg)
if type(msg) ~= "string" and type(msg) ~= "number" then
msg = format ("bad argument #1 to 'error' (string expected, got %s)", type(msg))
end
-- Logging error
SAPI.Response.errorlog (msg)
SAPI.Response.errorlog (" ")
SAPI.Response.errorlog (SAPI.Request.servervariable"REMOTE_ADDR")
SAPI.Response.errorlog (" ")
SAPI.Response.errorlog (date())
SAPI.Response.errorlog ("\n")
-- Building user message
msg = gsub (gsub (msg, "\n", "
\n"), "\t", " ")
SAPI.Response.contenttype ("text/html")
SAPI.Response.write ("