lib/geocoder/lookups/freegeoip.rb in geocoder-1.5.0 vs lib/geocoder/lookups/freegeoip.rb in geocoder-1.5.1
- old
+ new
@@ -5,11 +5,11 @@
class Freegeoip < Base
def name
"FreeGeoIP"
end
-
+
def supported_protocols
if configuration[:host]
[:http, :https]
else
# use https for default host
@@ -30,11 +30,11 @@
def parse_raw_data(raw_data)
raw_data.match(/^<html><title>404/) ? nil : super(raw_data)
end
def results(query)
- # don't look up a loopback address, just return the stored result
- return [reserved_result(query.text)] if query.loopback_ip_address?
+ # don't look up a loopback or private address, just return the stored result
+ return [reserved_result(query.text)] if query.internal_ip_address?
# note: Freegeoip.net returns plain text "Not Found" on bad request
(doc = fetch_data(query)) ? [doc] : []
end
def reserved_result(ip)