diff options
author | Konstantin Haase <konstantin.mailinglists@googlemail.com> | 2010-06-08 21:06:39 +0200 |
---|---|---|
committer | Michael Fellinger <m.fellinger@gmail.com> | 2010-06-09 12:57:13 +0900 |
commit | 85a70515faf372939cc50c2bd088c551fac76ed4 (patch) | |
tree | 1ac4147ff1e365ea674ddc8f39afd676bb6bc2a7 /lib/rack/urlmap.rb | |
parent | 88a41baa5ea4f69a00df3b52ec1fc79203c4b0e7 (diff) | |
download | rack-85a70515faf372939cc50c2bd088c551fac76ed4.tar.gz |
make sure PATH_INFO and SCRIPT_NAME get reset
Diffstat (limited to 'lib/rack/urlmap.rb')
-rw-r--r-- | lib/rack/urlmap.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rack/urlmap.rb b/lib/rack/urlmap.rb index b689473b..73508533 100644 --- a/lib/rack/urlmap.rb +++ b/lib/rack/urlmap.rb @@ -35,18 +35,20 @@ module Rack end def call(env) - path = env["PATH_INFO"].to_s + path = env["PATH_INFO"] script_name = env['SCRIPT_NAME'] hHost, sName, sPort = env.values_at('HTTP_HOST','SERVER_NAME','SERVER_PORT') @mapping.each { |host, location, match, app| next unless (hHost == host || sName == host \ || (host.nil? && (hHost == sName || hHost == sName+':'+sPort))) - next unless path =~ match && rest = $1 + next unless path.to_s =~ match && rest = $1 next unless rest.empty? || rest[0] == ?/ env.merge!('SCRIPT_NAME' => (script_name + location), 'PATH_INFO' => rest) return app.call(env) } [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{path}"]] + ensure + env.merge! 'PATH_INFO' => path, 'SCRIPT_NAME' => script_name end end end |