lib/rack/urlmap.rb in rack-0.4.0 vs lib/rack/urlmap.rb in rack-0.9.0
- old
+ new
@@ -24,10 +24,10 @@
raise ArgumentError, "paths need to start with /"
end
location = location.chomp('/')
[host, location, app]
- }.sort_by { |(h, l, a)| -l.size } # Longest path first
+ }.sort_by { |(h, l, a)| [-l.size, h.to_s.size] } # Longest path first
end
def call(env)
path = env["PATH_INFO"].to_s.squeeze("/")
hHost, sName, sPort = env.values_at('HTTP_HOST','SERVER_NAME','SERVER_PORT')