Software /
code /
prosody
Comparison
plugins/mod_http.lua @ 5230:6f5640375358
mod_http: Fix path length pattern
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 09 Dec 2012 12:20:55 +0100 |
parent | 5204:0b4f680ea116 |
child | 5332:5b73ac268a9e |
comparison
equal
deleted
inserted
replaced
5229:5566236f363f | 5230:6f5640375358 |
---|---|
86 if event_name then | 86 if event_name then |
87 if type(handler) ~= "function" then | 87 if type(handler) ~= "function" then |
88 local data = handler; | 88 local data = handler; |
89 handler = function () return data; end | 89 handler = function () return data; end |
90 elseif event_name:sub(-2, -1) == "/*" then | 90 elseif event_name:sub(-2, -1) == "/*" then |
91 local base_path_len = #event_name:match("(/.+/)%*$")+1; | 91 local base_path_len = #event_name:match("/.+$"); |
92 local _handler = handler; | 92 local _handler = handler; |
93 handler = function (event) | 93 handler = function (event) |
94 local path = event.request.path:sub(base_path_len); | 94 local path = event.request.path:sub(base_path_len); |
95 return _handler(event, path); | 95 return _handler(event, path); |
96 end; | 96 end; |