rack-entrance 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ module Rack
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 0
6
- TINY = 3
6
+ TINY = 4
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
9
9
  end
data/lib/rack/entrance.rb CHANGED
@@ -17,7 +17,10 @@ module Rack
17
17
  end
18
18
 
19
19
  def internal?(ip)
20
- internal_ips.include? ip
20
+ internal_ips.each do |internal_ip|
21
+ return true if ip.to_s.start_with?(internal_ip)
22
+ end
23
+ false
21
24
  end
22
25
 
23
26
  def internal_ips
@@ -20,6 +20,17 @@ describe Rack::Entrance do
20
20
  end
21
21
  end
22
22
 
23
+ context 'internal request by prefix' do
24
+ before do
25
+ ENV['ENTRANCE_INTERNAL_IPS'] = '203.0.113.255,127.0.'
26
+ get '/'
27
+ end
28
+
29
+ it 'sets internal to true' do
30
+ last_request.env['entrance.internal'].should be_true
31
+ end
32
+ end
33
+
23
34
  context 'external request' do
24
35
  before do
25
36
  ENV['ENTRANCE_INTERNAL_IPS'] = '192.0.2.21,203.0.113.255'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-entrance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-25 00:00:00.000000000 Z
12
+ date: 2013-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack