Issue #3711 has been updated by nahi.

Description updated
Assignee set to knu


----------------------------------------
Feature #3711: IPAddr must not make DNS lookups via IPSocket.getaddress
https://bugs.ruby-lang.org/issues/3711#change-24734

Author: pk
Status: Feedback
Priority: Normal
Assignee: knu
Category: 
Target version: 


=begin
 class MustNotCallError < NotImplementedError ; end
 
 class IpAddrNoResolvTestCase < Test::Unit::TestCase
 	def setup()
 		class << IPSocket
 			alias original_getaddress getaddress
 			def getaddress( host )
 				# DNS lookups are slow and totally unnecessary for IP addresses
 				raise MustNotCallError.new( 'IPAddr.new() must not call IPSocket.getaddress()!' )
 			end
 		end
 	end
 	def test_ipaddr_must_not_resolve_valid_ipv4_address
 		assert_nothing_raised { IPAddr.new( '1.2.3.4', Socket::AF_INET ) }
 	end
 	def test_ipaddr_must_not_resolve_invalid_ipv4_style_address
 		assert_raise( ArgumentError ) { IPAddr.new( '1.2.3.400', Socket::AF_INET ) }
 	end
 	def test_ipaddr_must_not_resolve_valid_ipv6_address
 		assert_nothing_raised { IPAddr.new( '::', Socket::AF_INET6 ) }
 	end
 	def test_ipaddr_must_not_resolve_invalid_ipv6_style_address
 		assert_raise( ArgumentError ) { IPAddr.new( '::1::', Socket::AF_INET6 ) }
 	end
 end
=end



-- 
http://bugs.ruby-lang.org/