/usr/share/lua/5.1/xavante/patternhandler.lua is in xavante 2.3.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 | -----------------------------------------------------------------------------
-- Xavante URL patterns handler
--
-- Authors: Fabio Mascarenhas
-- Copyright (c) 2006 Kepler Project
--
-- $Id: patternhandler.lua,v 1.2 2008/03/10 23:38:31 mascarenhas Exp $
-----------------------------------------------------------------------------
local httpd = require "xavante.httpd"
local function match_url (req, conf)
local path = req.relpath
for _, rule in ipairs(conf) do
for _, pat in ipairs(rule.pattern) do
local cap = { string.match(path, pat) }
if #cap > 0 then
req.handler = rule.handler
return cap
end
end
end
end
return function (conf)
if not conf or type (conf) ~= "table" then return nil end
return function (req, res)
local cap = match_url (req, conf) or {}
local h = req.handler or httpd.err_404
return h (req, res, cap)
end
end
|