diff options
Diffstat (limited to 'lib/open-uri.rb')
-rw-r--r-- | lib/open-uri.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb index e601c5cf5c..c6bfd7a509 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -488,6 +488,15 @@ module URI proxy_uri = ENV[name] || ENV[name.upcase] end + if proxy_uri && self.host + require 'socket' + begin + addr = IPSocket.getaddress(self.host) + proxy_uri = nil if /\A127\.|\A::1\z/ =~ addr + rescue SocketError + end + end + if proxy_uri proxy_uri = URI.parse(proxy_uri) unless URI::HTTP === proxy_uri |