Changeset

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
parents 4703:684ea42ca77a
children 4705:447f5a94792d
files net/http/server.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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