Project

General

Profile

Feature #4093

net/http rdoc improvements

Added by mperham (Mike Perham) almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:33433]

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

History

#1

Updated by naruse (Yui NARUSE) almost 9 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

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

#2

Updated by naruse (Yui NARUSE) almost 9 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

Also available in: Atom PDF