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 +4 -4
- data/lib/x-real-ip/middleware.rb +8 -2
- data/lib/x-real-ip/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b1ef773809a12f6019465eabd64f6f6d5b5a613
|
4
|
+
data.tar.gz: f4f94d0bb381da1fc0b56f6816c1de471f8343d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1a363c92605c450545b1fe8128bdde9acc7166f368a0a17e04da313837a16041affda402166407b8cd4b532b8608370f968eca61a4603ea822bf7f30d548dd
|
7
|
+
data.tar.gz: 68cf8a0d9ab42946ad58a50b62ce680fc895234f5fe2795cb8815060ce1ba9acb8ee33542b52f237ecf8e9698b2dbcdf3ae7101e81cdf8cf55cd28febd7f52b1
|
data/lib/x-real-ip/middleware.rb
CHANGED
@@ -5,7 +5,13 @@ module XRealIp
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def is_trusted?(str)
|
8
|
-
|
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
|
data/lib/x-real-ip/version.rb
CHANGED
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.
|
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:
|
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.
|
125
|
+
rubygems_version: 2.4.5
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: ''
|