From 37b7b73477f340c4c6518bd5315426e9070507a7 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Wed, 28 Sep 2011 22:41:18 -0700 Subject: [PATCH] Add parens for 'Ambiguous first argument' warnings in jruby --- lib/rack/protection/ip_spoofing.rb | 2 +- lib/rack/protection/path_traversal.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rack/protection/ip_spoofing.rb b/lib/rack/protection/ip_spoofing.rb index d16bb57..3e404ad 100644 --- a/lib/rack/protection/ip_spoofing.rb +++ b/lib/rack/protection/ip_spoofing.rb @@ -13,7 +13,7 @@ class IPSpoofing < Base def accepts?(env) return true unless env.include? 'HTTP_X_FORWARDED_FOR' - ips = env['HTTP_X_FORWARDED_FOR'].split /\s*,\s*/ + ips = env['HTTP_X_FORWARDED_FOR'].split(/\s*,\s*/) return false if env.include? 'HTTP_CLIENT_IP' and not ips.include? env['HTTP_CLIENT_IP'] return false if env.include? 'HTTP_X_REAL_IP' and not ips.include? env['HTTP_X_REAL_IP'] true diff --git a/lib/rack/protection/path_traversal.rb b/lib/rack/protection/path_traversal.rb index 4da77d4..09673ea 100644 --- a/lib/rack/protection/path_traversal.rb +++ b/lib/rack/protection/path_traversal.rb @@ -22,7 +22,7 @@ def cleanup(path) return cleanup("/" << path)[1..-1] unless path[0] == ?/ escaped = ::File.expand_path path.gsub('%2e', '.').gsub('%2f', '/') escaped << '/' if escaped[-1] != ?/ and path =~ /\/\.{0,2}$/ - escaped.gsub /\/\/+/, '/' + escaped.gsub(/\/\/+/, '/') end end end