lib/spf/util.rb in spf-0.0.5 vs lib/spf/util.rb in spf-0.0.6
- old
+ new
@@ -43,9 +43,11 @@
/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})/i
end
def self.hostname
return @hostname ||= Socket.gethostbyname(Socket.gethostname).first
+ rescue SocketError
+ return @hostname ||= Socket.gethostname
end
def self.ipv4_address_to_ipv6(ipv4_address)
unless IP::V4 === ipv4_address
raise SPF::InvalidOptionValueError.new('IP::V4 address expected')