Comparison

plugins/mod_http.lua @ 8972:0b254439d451

mod_http: Rename argument to avoid name clash with outer scope [luacheck]
author Kim Alvefur <zash@zash.se>
date Fri, 06 Jul 2018 00:15:10 +0200
parent 8971:e59207c909c0
child 9335:2dc7490899ae
comparison
equal deleted inserted replaced
8971:e59207c909c0 8972:0b254439d451
106 local data = handler; 106 local data = handler;
107 handler = function () return data; end 107 handler = function () return data; end
108 elseif event_name:sub(-2, -1) == "/*" then 108 elseif event_name:sub(-2, -1) == "/*" then
109 local base_path_len = #event_name:match("/.+$"); 109 local base_path_len = #event_name:match("/.+$");
110 local _handler = handler; 110 local _handler = handler;
111 handler = function (event) 111 handler = function (_event)
112 local path = event.request.path:sub(base_path_len); 112 local path = _event.request.path:sub(base_path_len);
113 return _handler(event, path); 113 return _handler(_event, path);
114 end; 114 end;
115 module:hook_object_event(server, event_name:sub(1, -3), redir_handler, -1); 115 module:hook_object_event(server, event_name:sub(1, -3), redir_handler, -1);
116 elseif event_name:sub(-1, -1) == "/" then 116 elseif event_name:sub(-1, -1) == "/" then
117 module:hook_object_event(server, event_name:sub(1, -2), redir_handler, -1); 117 module:hook_object_event(server, event_name:sub(1, -2), redir_handler, -1);
118 end 118 end