/usr/share/lua/5.1/wsapi/fastcgi.lua is in lua-wsapi 1.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | -----------------------------------------------------------------------------
-- Fastcgi WSAPI handler
--
-- Author: Fabio Mascarenhas
-- Copyright (c) 2007 Kepler Project
--
-----------------------------------------------------------------------------
local lfcgi = require"lfcgi"
local os = require"os"
local io = require"io"
local common = require"wsapi.common"
local ipairs = ipairs
local _M = {}
io.stdout = lfcgi.stdout
io.stderr = lfcgi.stderr
io.stdin = lfcgi.stdin
-- Runs an WSAPI application for each FastCGI request that comes
-- from the FastCGI pipeline
function _M.run(app_run)
while lfcgi.accept() >= 0 do
local headers
local function getenv(n)
if n == "headers" then
if headers then return headers end
local env_vars = lfcgi.environ()
headers = {}
for _, s in ipairs(env_vars) do
local name, val = s:match("^([^=]+)=(.*)$")
headers[name] = val
end
return headers
else
return lfcgi.getenv(n) or os.getenv(n)
end
end
common.run(app_run, { input = lfcgi.stdin,
output = lfcgi.stdout,
error = lfcgi.stderr,
env = getenv })
end
end
return _M
|