Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/brian-ewell/geocoder into b…

…rian-ewell-master
  • Loading branch information...
commit 12ffe1a931a964a34cf7f3f0e022bdb92fe4d9cf 2 parents b418e0e + 9db067d
Alex Reisner authored
Showing with 3 additions and 1 deletion.
  1. +1 −1  lib/geocoder.rb
  2. +2 −0  test/input_handling_test.rb
2  lib/geocoder.rb
View
@@ -115,7 +115,7 @@ def spawn_lookup(name)
# dot-delimited numbers.
#
def ip_address?(value)
- !!value.to_s.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
+ !!value.to_s.match(/^(::ffff:)?(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
end
##
2  test/input_handling_test.rb
View
@@ -6,8 +6,10 @@ class InputHandlingTest < Test::Unit::TestCase
def test_ip_address_detection
assert Geocoder.send(:ip_address?, "232.65.123.94")
assert Geocoder.send(:ip_address?, "666.65.123.94") # technically invalid
+ assert Geocoder.send(:ip_address?, "::ffff:12.34.56.78")
assert !Geocoder.send(:ip_address?, "232.65.123.94.43")
assert !Geocoder.send(:ip_address?, "232.65.123")
+ assert !Geocoder.send(:ip_address?, "::ffff:123.456.789")
end
def test_blank_query_detection
Please sign in to comment.
Something went wrong with that request. Please try again.