Skip to content

Empty PATH_INFO is (probably) invalid and will (probably) fail in Rack 3.2. #2113

@ioquatix

Description

@ioquatix

See rack/rack#2316 and rack/rack#2307 for background.

These two tests use an empty PATH_INFO which is basically invalid:

it 'matches empty PATH_INFO to "/" if no route is defined for ""' do
mock_app do
get '/' do
'worked'
end
end
get '/', {}, "PATH_INFO" => ""
assert ok?
assert_equal 'worked', body
end
it 'matches empty PATH_INFO to "" if a route is defined for ""' do
mock_app do
disable :protection
get '/' do
'did not work'
end
get '' do
'worked'
end
end
get '/', {}, "PATH_INFO" => ""
assert ok?
assert_equal 'worked', body
end

A web server request must always begin with a / character, e.g.

GET / HTTP/1.0
...

There is no way that the PATH_INFO can be an empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions