diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-01 15:31:59 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-01 15:31:59 +0000 |
| commit | 900890fb6f0b34242fe3620cc45f3669e487c855 (patch) | |
| tree | eca20592192649fd62f4e2cb7ff6fe215705a32f | |
| parent | e3b94dcec696ef06b89b26566f10ef002860dbb4 (diff) | |
| download | ruby-900890fb6f0b34242fe3620cc45f3669e487c855.tar.gz ruby-900890fb6f0b34242fe3620cc45f3669e487c855.tar.xz ruby-900890fb6f0b34242fe3620cc45f3669e487c855.zip | |
* lib/open-uri.rb (URI::Generic#find_proxy): return nil on loopback
address.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@5606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/open-uri.rb | 9 |
2 files changed, 13 insertions, 1 deletions
@@ -1,4 +1,7 @@ -Mon Feb 2 00:01:19 2004 Tanaka Akira <akr@m17n.org> +Mon Feb 2 00:28:54 2004 Tanaka Akira <akr@m17n.org> + + * lib/open-uri.rb (URI::Generic#find_proxy): return nil on loopback + address. * lib/resolv-replace.rb (BasicSocket#send): don't replace because it has no hostname argument. diff --git a/lib/open-uri.rb b/lib/open-uri.rb index e601c5cf5..c6bfd7a50 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 |
