@@ -25,6 +25,12 @@ local cur_level = ngx.config.subsystem == "http" and
2525 require (" ngx.errlog" ).get_sys_filter_level ()
2626local ngx_var = ngx .var
2727local re_find = ngx .re .find
28+ local empty_table = {}
29+
30+
31+ setmetatable (empty_table , {__newindex = function ()
32+ error (" empty_table can not be changed" )
33+ end })
2834
2935
3036local function load_shared_lib (so_name )
@@ -519,6 +525,7 @@ local function match_route_opts(route, opts)
519525 return true
520526end
521527
528+
522529local function _match_from_routes (routes , path , opts )
523530 for _ , route in ipairs (routes ) do
524531 if route .path_op == " =" then
@@ -534,9 +541,11 @@ local function _match_from_routes(routes, path, opts)
534541 end
535542 end
536543 end
544+
537545 return nil
538546end
539547
548+
540549local function match_route (self , path , opts )
541550 local routes = self .hash_path [path ]
542551 if routes then
@@ -570,7 +579,7 @@ local function match_route(self, path, opts)
570579 return nil
571580end
572581
573- local empty_table = {}
582+
574583function _M .match (self , path , opts )
575584 if type (path ) ~= " string" then
576585 error (" invalid argument path" , 2 )
@@ -610,4 +619,5 @@ function _M.dispatch(self, path, opts, ...)
610619 return true
611620end
612621
622+
613623return _M
0 commit comments