Comparison

net/http/server.lua @ 4694:f9a091b6dfd5

net.http.server: Fix to compare priority if path lengths are the same (logic fail)
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Apr 2012 04:24:43 +0100
parent 4691:a164fc7057ae
child 4704:d6c4e58333cf
comparison
equal deleted inserted replaced
4693:7ef4faa056fb 4694:f9a091b6dfd5
48 end 48 end
49 if #handlers_array == 0 then return; end 49 if #handlers_array == 0 then return; end
50 table.sort(handlers_array, function(b, a) 50 table.sort(handlers_array, function(b, a)
51 local a_score, b_score = matching_handlers_set[a], matching_handlers_set[b]; 51 local a_score, b_score = matching_handlers_set[a], matching_handlers_set[b];
52 for i = 1, #a_score do 52 for i = 1, #a_score do
53 if a ~= b then -- If equal, compare next score value 53 if a_score[i] ~= b_score[i] then -- If equal, compare next score value
54 return a_score[i] < b_score[i]; 54 return a_score[i] < b_score[i];
55 end 55 end
56 end 56 end
57 return false; 57 return false;
58 end); 58 end);