net.http.server: Lower score of wildcard handlers to ensure specific handlers beat them
authorMatthew Wild <mwild1@gmail.com>
Thu, 26 Apr 2012 06:47:17 +0100
changeset 4704 d6c4e58333cf
parent 4703 684ea42ca77a
child 4705 447f5a94792d
net.http.server: Lower score of wildcard handlers to ensure specific handlers beat them
net/http/server.lua
--- a/net/http/server.lua	Thu Apr 26 06:42:02 2012 +0100
+++ b/net/http/server.lua	Thu Apr 26 06:47:17 2012 +0100
@@ -41,7 +41,7 @@
 			if event == curr_event or
 			is_wildcard_event(event) and is_wildcard_match(event, curr_event) then
 				for handler, priority in pairs(handlers_set) do
-					matching_handlers_set[handler] = { (select(2, event:gsub("/", "%1"))), priority };
+					matching_handlers_set[handler] = { (select(2, event:gsub("/", "%1"))), is_wildcard_event(event) and 0 or 1, priority };
 					table.insert(handlers_array, handler);
 				end
 			end