summaryrefslogtreecommitdiff
path: root/lib/open-uri.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-06 03:30:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-06 03:30:49 +0000
commit5fd45a4b79dd26f9e7b6dc41142912df911e4d7d (patch)
tree7cdb7ea6a408e863811acd5ba6c44ad0380fe6b1 /lib/open-uri.rb
parent915ae780c37478fea358d6c77513a728e86a10f2 (diff)
* lib/uri/generic.rb (URI::Generic#hostname): new method.
(URI::Generic#hostname=): ditto. * lib/open-uri.rb: use URI#hostname * lib/net/http.rb: ditto. [ruby-core:32056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/open-uri.rb')
-rw-r--r--lib/open-uri.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index bb45d63ae6..6706068300 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -263,17 +263,17 @@ module OpenURI
# HTTP or HTTPS
if proxy
if proxy_user && proxy_pass
- klass = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_user, proxy_pass)
+ klass = Net::HTTP::Proxy(proxy_uri.hostname, proxy_uri.port, proxy_user, proxy_pass)
else
- klass = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port)
+ klass = Net::HTTP::Proxy(proxy_uri.hostname, proxy_uri.port)
end
end
- target_host = target.host
+ target_host = target.hostname
target_port = target.port
request_uri = target.request_uri
else
# FTP over HTTP proxy
- target_host = proxy_uri.host
+ target_host = proxy_uri.hostname
target_port = proxy_uri.port
request_uri = target.to_s
if proxy_user && proxy_pass
@@ -736,10 +736,10 @@ module URI
proxy_uri = ENV[name] || ENV[name.upcase]
end
- if proxy_uri && self.host
+ if proxy_uri && self.hostname
require 'socket'
begin
- addr = IPSocket.getaddress(self.host)
+ addr = IPSocket.getaddress(self.hostname)
proxy_uri = nil if /\A127\.|\A::1\z/ =~ addr
rescue SocketError
end
@@ -804,7 +804,7 @@ module URI
# The access sequence is defined by RFC 1738
ftp = Net::FTP.new
- ftp.connect(self.host, self.port)
+ ftp.connect(self.hostname, self.port)
ftp.passive = true if !options[:ftp_active_mode]
# todo: extract user/passwd from .netrc.
user = 'anonymous'