x-real-ip 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40dcab19213ac6ec705d3cfd3de76f6e78ed7d32
4
- data.tar.gz: fd2e8c28946aad55514a85d930e142c3716b703d
3
+ metadata.gz: 9b1ef773809a12f6019465eabd64f6f6d5b5a613
4
+ data.tar.gz: f4f94d0bb381da1fc0b56f6816c1de471f8343d5
5
5
  SHA512:
6
- metadata.gz: cd0f3def36a4139b095a9e7d19caf1e1cc0c17f478111fb42c551b648c80bbacae95e49fe44a43247f95edbab79ce2e36096aebd4cb282e853fbcd18a7a0d54a
7
- data.tar.gz: 91fad53ba60d914d54ab1ed26500905998094f762252b7ebfc55175934c1e54dd3f0938e8421068372b1c39de4dc33f6e07216c280913dee71be02d5f16b265e
6
+ metadata.gz: 8a1a363c92605c450545b1fe8128bdde9acc7166f368a0a17e04da313837a16041affda402166407b8cd4b532b8608370f968eca61a4603ea822bf7f30d548dd
7
+ data.tar.gz: 68cf8a0d9ab42946ad58a50b62ce680fc895234f5fe2795cb8815060ce1ba9acb8ee33542b52f237ecf8e9698b2dbcdf3ae7101e81cdf8cf55cd28febd7f52b1
@@ -5,7 +5,13 @@ module XRealIp
5
5
  end
6
6
 
7
7
  def is_trusted?(str)
8
- ip = IPAddr.new(str)
8
+ begin
9
+ ip = IPAddr.new(str.strip)
10
+ rescue Exception => e
11
+ $stderr.puts "Error in x-real-ip parsing address '#{str.strip}': #{e.message}"
12
+ $stderr.puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
13
+ raise e
14
+ end
9
15
  XRealIp.trusted.any? { |proxy| proxy === ip }
10
16
  end
11
17
 
@@ -41,7 +47,7 @@ module XRealIp
41
47
  end
42
48
  end
43
49
  rescue => e
44
- $stderr.puts "Error in x-real-ip: #{$!}"
50
+ $stderr.puts "Error in x-real-ip: #{e.message}"
45
51
  $stderr.puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
46
52
  end
47
53
  end
@@ -1,4 +1,4 @@
1
1
  module XRealIp
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: x-real-ip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 55ideas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-19 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.4.5
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: ''