1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Add PATH_INFO to the env

This commit is contained in:
Evan Phoenix 2011-10-14 12:15:35 -07:00
parent d4fdd8c643
commit 1657f579d7
3 changed files with 14 additions and 0 deletions

View file

@ -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

View file

@ -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)

View file

@ -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