-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpatch_to_fix_innate_ipaddress_issue_on_windows.patch
61 lines (54 loc) · 1.83 KB
/
patch_to_fix_innate_ipaddress_issue_on_windows.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
*** lib/innate.rb Wed Sep 29 16:10:49 2010
--- lib/innate.rb_orig Wed Oct 6 09:51:11 2010
***************
*** 17,23 ****
require 'digest/sha1'
require 'digest/sha2'
require 'find'
! require 'ipaddress'
require 'logger'
require 'pathname'
require 'pp'
--- 17,23 ----
require 'digest/sha1'
require 'digest/sha2'
require 'find'
! require 'ipaddr'
require 'logger'
require 'pathname'
require 'pp'
***************
*** lib/innate/request.rb Wed Sep 29 16:11:36 2010
--- lib/innate/request.rb_orig Wed Oct 6 09:53:03 2010
***************
*** 124,130 ****
ipv4 = %w[ 127.0.0.1/32 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8
169.254.0.0/16 ]
ipv6 = %w[ fc00::/7 fe80::/10 fec0::/10 ::1 ]
! LOCAL = (ipv4 + ipv6).map{|range| IPAddress(range)} unless
defined?(LOCAL)
# Request is from a local network?
# Checks both IPv4 and IPv6
--- 124,130 ----
ipv4 = %w[ 127.0.0.1/32 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8
169.254.0.0/16 ]
ipv6 = %w[ fc00::/7 fe80::/10 fec0::/10 ::1 ]
! LOCAL = (ipv4 + ipv6).map{|range| IPAddr.new(range)} unless
defined?(LOCAL)
# Request is from a local network?
# Checks both IPv4 and IPv6
***************
*** 132,138 ****
# Optional argument address can be used to check any IP address.
def local_net?(address = ip)
! addr = IPAddress(address)
LOCAL.find{|range| range.include?(addr) }
rescue ArgumentError => ex
raise ArgumentError, ex unless ex.message == 'invalid address'
--- 132,138 ----
# Optional argument address can be used to check any IP address.
def local_net?(address = ip)
! addr = IPAddr.new(address)
LOCAL.find{|range| range.include?(addr) }
rescue ArgumentError => ex
raise ArgumentError, ex unless ex.message == 'invalid address'