Feature #4093
closednet/http rdoc improvements
Description
=begin
I've reworked the main net/http rdoc to fix English grammar and give more examples:
- request and response headers
- GET with static and dynamic parameters
- response status code
All of these were actual things that confused me as a new Rubyist trying to figure out how to use net/http.
Commits are here:
https://github.com/mperham/ruby/commit/7d703620f353788f34d7517e0cf3d42c41e8532a
https://github.com/mperham/ruby/commit/af111481dd4b06ba1c2cd7ff82366e822629193e
=end
Updated by naruse (Yui NARUSE) over 13 years ago
=begin
I merge your patch, thanks!
Following are comments:
url.query = params.inject([]) { |memo, (k, v)| memo << "#{k}=#{CGI::escape(v.to_s)}"; memo }.join("&")¶
You can use URI.encode_www_form(params).
res = Net::HTTP.new(url.hostname, url.port).start {|http| http.request(req) }¶
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }¶
url.hostname is correct.
see http://redmine.ruby-lang.org/issues/show/3788
Net::HTTP::Proxy(proxy_addr, proxy_port).start('www.example.com') {|http|¶
Net::HTTP.Proxy(proxy_addr, proxy_port).start('www.example.com') {|http|¶
Ruby sometimes use a method whose name begin with upper case,
like Integer(), Array(), and URI(). They are syntactically only a method,
but s semantically considered as a class method. Such method should be like
Net::HTTP::Proxy().
=end
Updated by naruse (Yui NARUSE) over 13 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r29953.
Mike, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end