summaryrefslogtreecommitdiff
path: root/lib/net
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/net
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/net')
-rw-r--r--lib/net/http.rb10
1 files changed, 5 insertions, 5 deletions
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