summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-07-25 12:45:38 +0000
committerSteven Barth <steven@midlink.org>2009-07-25 12:45:38 +0000
commit0371fc26d8950833446c9521bae8df226b5f7daf (patch)
tree3d25011b5e124e9a2c3d0dde4420d69ddd8d286e /libs/web/luasrc
parenta77f1b91aeb9d6770a2fa5bc83a6100119e825d1 (diff)
Reintroduce prefisx support - was gone somewhere
Diffstat (limited to 'libs/web/luasrc')
-rw-r--r--libs/web/luasrc/dispatcher.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 01cc109219..a375eecc84 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -108,13 +108,21 @@ end
--- Dispatch an HTTP request.
-- @param request LuCI HTTP Request object
-function httpdispatch(request)
+function httpdispatch(request, prefix)
luci.http.context.request = request
- context.request = {}
+
+ local r = {}
+ context.request = r
local pathinfo = http.urldecode(request:getenv("PATH_INFO") or "", true)
+ if prefix then
+ for _, node in ipairs(prefix) do
+ r[#r+1] = node
+ end
+ end
+
for node in pathinfo:gmatch("[^/]+") do
- table.insert(context.request, node)
+ r[#r+1] = node
end
local stat, err = util.coxpcall(function()