deal with PATH_INFO being nil, fixes #7

This commit is contained in:
Konstantin Haase 2011-10-04 14:54:47 -07:00
parent 6f1ae47820
commit 4491e2676d
4 changed files with 8 additions and 3 deletions

View File

@ -12,7 +12,7 @@ module Rack
class PathTraversal < Base
def call(env)
path_was = env["PATH_INFO"]
env["PATH_INFO"] = cleanup path_was
env["PATH_INFO"] = cleanup path_was if path_was
app.call env
ensure
env["PATH_INFO"] = path_was

View File

@ -4,7 +4,7 @@ module Rack
VERSION
end
SIGNATURE = [1, 1, 2]
SIGNATURE = [1, 1, 4]
VERSION = SIGNATURE.join('.')
VERSION.extend Comparable

View File

@ -2,7 +2,7 @@
Gem::Specification.new do |s|
# general infos
s.name = "rack-protection"
s.version = "1.1.2"
s.version = "1.1.4"
s.description = "You should use protection!"
s.homepage = "http://github.com/rkh/rack-protection"
s.summary = s.description

View File

@ -19,5 +19,10 @@ describe Rack::Protection::PathTraversal do
}.each do |a, b|
it("replaces #{a.inspect} with #{b.inspect}") { get(a).body.should == b }
end
it 'should be able to deal with PATH_INFO = nil (fcgi?)' do
app = Rack::Protection::PathTraversal.new(proc { 42 })
app.call({}).should be == 42
end
end
end