ruby-changes:37197
From: naruse <ko1@a...>
Date: Fri, 16 Jan 2015 16:50:21 +0900 (JST)
Subject: [ruby-changes:37197] naruse:r49278 (ruby_2_2): merge revision(s) 49104, 49105: [Backport #10692]
naruse 2015-01-16 16:50:04 +0900 (Fri, 16 Jan 2015) New Revision: 49278 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49278 Log: merge revision(s) 49104,49105: [Backport #10692] * test/net/http/test_http.rb (_test_send_request__HEAD): Added failing test for send_request with HEAD method. * lib/net/http.rb (Net::HTTP#send_request): there is no response body with HEAD request. Patch by @rodrigosaito [fix GH-520] Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/lib/net/http.rb branches/ruby_2_2/test/net/http/test_http.rb branches/ruby_2_2/version.h Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 49277) +++ ruby_2_2/ChangeLog (revision 49278) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Fri Jan 16 16:49:04 2015 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * lib/net/http.rb (Net::HTTP#send_request): there is no response body + with HEAD request. Patch by @rodrigosaito [fix GH-520] + +Fri Jan 16 16:49:04 2015 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * test/net/http/test_http.rb (_test_send_request__HEAD): Added + failing test for send_request with HEAD method. + Fri Jan 16 14:56:08 2015 Eric Wong <e@8...> * symbol.c (rb_gc_free_dsymbol): delete from global fstr hash Index: ruby_2_2/lib/net/http.rb =================================================================== --- ruby_2_2/lib/net/http.rb (revision 49277) +++ ruby_2_2/lib/net/http.rb (revision 49278) @@ -1350,7 +1350,8 @@ module Net #:nodoc: https://github.com/ruby/ruby/blob/trunk/ruby_2_2/lib/net/http.rb#L1350 # puts response.body # def send_request(name, path, data = nil, header = nil) - r = HTTPGenericRequest.new(name,(data ? true : false),true,path,header) + has_response_body = name != 'HEAD' + r = HTTPGenericRequest.new(name,(data ? true : false),has_response_body,path,header) request r, data end Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 49277) +++ ruby_2_2/version.h (revision 49278) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.0" #define RUBY_RELEASE_DATE "2015-01-16" -#define RUBY_PATCHLEVEL 11 +#define RUBY_PATCHLEVEL 12 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 1 Index: ruby_2_2/test/net/http/test_http.rb =================================================================== --- ruby_2_2/test/net/http/test_http.rb (revision 49277) +++ ruby_2_2/test/net/http/test_http.rb (revision 49278) @@ -578,6 +578,7 @@ module TestNetHTTP_version_1_2_methods https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/net/http/test_http.rb#L578 def test_send_request start {|http| _test_send_request__GET http + _test_send_request__HEAD http _test_send_request__POST http } end @@ -592,6 +593,16 @@ module TestNetHTTP_version_1_2_methods https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/net/http/test_http.rb#L593 assert_equal $test_net_http_data, res.body end + def _test_send_request__HEAD(http) + res = http.send_request('HEAD', '/') + assert_kind_of Net::HTTPResponse, res + unless self.is_a?(TestNetHTTP_v1_2_chunked) + assert_not_nil res['content-length'] + assert_equal $test_net_http_data.size, res['content-length'].to_i + end + assert_nil res.body + end + def _test_send_request__POST(http) data = 'aaabbb cc ddddddddddd lkjoiu4j3qlkuoa' res = http.send_request('POST', '/', data, 'content-type' => 'application/x-www-form-urlencoded') Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49104-49105 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/