From 5fd45a4b79dd26f9e7b6dc41142912df911e4d7d Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 6 Oct 2010 03:30:49 +0000 Subject: * 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 --- lib/net/http.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/net') diff --git a/lib/net/http.rb b/lib/net/http.rb index 920301f350..0ae1ba8c8f 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -64,7 +64,7 @@ module Net #:nodoc: # require 'uri' # # url = URI.parse('http://www.example.com/index.html') - # res = Net::HTTP.start(url.host, url.port) {|http| + # res = Net::HTTP.start(url.hostname, url.port) {|http| # http.get('/index.html') # } # puts res.body @@ -75,7 +75,7 @@ module Net #:nodoc: # # url = URI.parse('http://www.example.com/index.html') # req = Net::HTTP::Get.new(url.path) - # res = Net::HTTP.start(url.host, url.port) {|http| + # res = Net::HTTP.start(url.hostname, url.port) {|http| # http.request(req) # } # puts res.body @@ -101,7 +101,7 @@ module Net #:nodoc: # req = Net::HTTP::Post.new(url.path) # req.basic_auth 'jack', 'pass' # req.set_form_data({'from' => '2005-01-01', 'to' => '2005-03-31'}, ';') - # res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) } + # res = Net::HTTP.new(url.hostname, url.port).start {|http| http.request(req) } # case res # when Net::HTTPSuccess, Net::HTTPRedirection # # OK @@ -390,7 +390,7 @@ module Net #:nodoc: } else uri = uri_or_host - new(uri.host, uri.port).start {|http| + new(uri.hostname, uri.port).start {|http| return http.request_get(uri.request_uri, &block) } end @@ -415,7 +415,7 @@ module Net #:nodoc: req = Post.new(url.path) req.form_data = params req.basic_auth url.user, url.password if url.user - new(url.host, url.port).start {|http| + new(url.hostname, url.port).start {|http| http.request(req) } end -- cgit v1.2.3