[前][次][番号順一覧][スレッド一覧]

ruby-changes:37297

From: usa <ko1@a...>
Date: Thu, 22 Jan 2015 17:31:55 +0900 (JST)
Subject: [ruby-changes:37297] usa:r49378 (ruby_2_0_0): merge revision(s) 49104, 49105: [Backport #10692]

usa	2015-01-22 17:31:38 +0900 (Thu, 22 Jan 2015)

  New Revision: 49378

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49378

  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_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/net/http.rb
    branches/ruby_2_0_0/test/net/http/test_http.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 49377)
+++ ruby_2_0_0/ChangeLog	(revision 49378)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Thu Jan 22 17:30:33 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]
+
+Thu Jan 22 17:30:33 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.
+
 Wed Jan 14 16:53:14 2015  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* ext/tk/lib/tkextlib/tcllib/plotchart.rb: fix to invoke correct function
Index: ruby_2_0_0/lib/net/http.rb
===================================================================
--- ruby_2_0_0/lib/net/http.rb	(revision 49377)
+++ ruby_2_0_0/lib/net/http.rb	(revision 49378)
@@ -1348,7 +1348,8 @@ module Net   #:nodoc: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/net/http.rb#L1348
     #    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_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 49377)
+++ ruby_2_0_0/version.h	(revision 49378)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2015-01-14"
-#define RUBY_PATCHLEVEL 614
+#define RUBY_RELEASE_DATE "2015-01-22"
+#define RUBY_PATCHLEVEL 615
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 1
-#define RUBY_RELEASE_DAY 14
+#define RUBY_RELEASE_DAY 22
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/net/http/test_http.rb
===================================================================
--- ruby_2_0_0/test/net/http/test_http.rb	(revision 49377)
+++ ruby_2_0_0/test/net/http/test_http.rb	(revision 49378)
@@ -574,6 +574,7 @@ module TestNetHTTP_version_1_2_methods https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/net/http/test_http.rb#L574
   def test_send_request
     start {|http|
       _test_send_request__GET http
+      _test_send_request__HEAD http
       _test_send_request__POST http
     }
   end
@@ -588,6 +589,16 @@ module TestNetHTTP_version_1_2_methods https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/net/http/test_http.rb#L589
     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_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49104-49105


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]