vendor/rack/lib/rack/urlmap.rb in relevance-castronaut-0.5.4 vs vendor/rack/lib/rack/urlmap.rb in relevance-castronaut-0.6.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')