Software /
code /
prosody
Comparison
net/http/server.lua @ 4704:d6c4e58333cf
net.http.server: Lower score of wildcard handlers to ensure specific handlers beat them
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 26 Apr 2012 06:47:17 +0100 |
parent | 4694:f9a091b6dfd5 |
child | 4706:845393c76d17 |
comparison
equal
deleted
inserted
replaced
4703:684ea42ca77a | 4704:d6c4e58333cf |
---|---|
39 local handlers_array = {}; | 39 local handlers_array = {}; |
40 for event, handlers_set in pairs(event_map) do | 40 for event, handlers_set in pairs(event_map) do |
41 if event == curr_event or | 41 if event == curr_event or |
42 is_wildcard_event(event) and is_wildcard_match(event, curr_event) then | 42 is_wildcard_event(event) and is_wildcard_match(event, curr_event) then |
43 for handler, priority in pairs(handlers_set) do | 43 for handler, priority in pairs(handlers_set) do |
44 matching_handlers_set[handler] = { (select(2, event:gsub("/", "%1"))), priority }; | 44 matching_handlers_set[handler] = { (select(2, event:gsub("/", "%1"))), is_wildcard_event(event) and 0 or 1, priority }; |
45 table.insert(handlers_array, handler); | 45 table.insert(handlers_array, handler); |
46 end | 46 end |
47 end | 47 end |
48 end | 48 end |
49 if #handlers_array == 0 then return; end | 49 if #handlers_array == 0 then return; end |