diff --git a/lib/puma/const.rb b/lib/puma/const.rb index 81f755e9..9a6d8b29 100644 --- a/lib/puma/const.rb +++ b/lib/puma/const.rb @@ -69,6 +69,8 @@ module Puma REQUEST_URI= 'REQUEST_URI'.freeze REQUEST_PATH = 'REQUEST_PATH'.freeze + PATH_INFO = 'PATH_INFO'.freeze + PUMA_VERSION = VERSION = "0.8.0".freeze PUMA_TMP_BASE = "puma".freeze diff --git a/lib/puma/server.rb b/lib/puma/server.rb index 8b2ad8d4..6d04c9dc 100644 --- a/lib/puma/server.rb +++ b/lib/puma/server.rb @@ -199,6 +199,8 @@ module Puma raise "No REQUEST PATH" unless env[REQUEST_PATH] end + env[PATH_INFO] = env[REQUEST_PATH] + # From http://www.ietf.org/rfc/rfc3875 : # "Script authors should be aware that the REMOTE_ADDR and # REMOTE_HOST meta-variables (see sections 4.1.8 and 4.1.9) diff --git a/test/test_rack_server.rb b/test/test_rack_server.rb index 5ee550fa..38fe4216 100644 --- a/test/test_rack_server.rb +++ b/test/test_rack_server.rb @@ -63,4 +63,14 @@ class TestRackServer < Test::Unit::TestCase raise exc end end + + def test_path_info + input = nil + @server.app = lambda { |env| input = env; @simple.call(env) } + @server.run + + hit(['http://localhost:9998/test/a/b/c']) + + assert_equal "/test/a/b/c", input['PATH_INFO'] + end end