9a2fafb0ef068b44e5990e4f4825ff2184aa49e9
[project/luci.git] / core / contrib / webuci_bootstrap.lua
1 package.path = "/usr/lib/lua/?.lua;/usr/lib/lua/?/init.lua;" .. package.path
2 package.cpath = "/usr/lib/lua/?.so;" .. package.cpath
3 module("webuci", package.seeall)
4
5 function prepare_req(uri)
6 env = {}
7 env.REQUEST_URI = uri
8 require("ffluci.menu").get()
9 end
10
11 function init_req(context)
12 env.SERVER_PROTOCOL = context.server_proto
13 env.REMOTE_ADDR = context.remote_addr
14 env.REQUEST_METHOD = context.request_method
15 env.PATH_INFO = "/" .. context.uri
16 env.REMOTE_PORT = context.remote_port
17 env.SERVER_ADDR = context.server_addr
18 env.SCRIPT_NAME = REQUEST_URI:sub(1, #REQUEST_URI - #PATH_INFO)
19 end
20
21 function handle_req(context)
22 require("ffluci.dispatcher").httpdispatch()
23 end