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

ruby-changes:37703

From: nagachika <ko1@a...>
Date: Sun, 1 Mar 2015 01:03:30 +0900 (JST)
Subject: [ruby-changes:37703] nagachika:r49784 (ruby_2_1): merge revision(s) r49104, r49105: [Backport #10692]

nagachika	2015-03-01 01:03:10 +0900 (Sun, 01 Mar 2015)

  New Revision: 49784

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

  Log:
    merge revision(s) r49104,r49105: [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_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/lib/net/http.rb
    branches/ruby_2_1/test/net/http/test_http.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 49783)
+++ ruby_2_1/ChangeLog	(revision 49784)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Sun Mar  1 01:01:21 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]
+
+Sun Mar  1 01:01:21 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.
+
 Sun Mar  1 00:58:30 2015  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* ext/zlib/zlib.c: fix document of method signatures.
Index: ruby_2_1/lib/net/http.rb
===================================================================
--- ruby_2_1/lib/net/http.rb	(revision 49783)
+++ ruby_2_1/lib/net/http.rb	(revision 49784)
@@ -1350,7 +1350,8 @@ module Net   #:nodoc: https://github.com/ruby/ruby/blob/trunk/ruby_2_1/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_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 49783)
+++ ruby_2_1/version.h	(revision 49784)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.5"
 #define RUBY_RELEASE_DATE "2015-03-01"
-#define RUBY_PATCHLEVEL 301
+#define RUBY_PATCHLEVEL 302
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_1/test/net/http/test_http.rb
===================================================================
--- ruby_2_1/test/net/http/test_http.rb	(revision 49783)
+++ ruby_2_1/test/net/http/test_http.rb	(revision 49784)
@@ -574,6 +574,7 @@ module TestNetHTTP_version_1_2_methods https://github.com/ruby/ruby/blob/trunk/ruby_2_1/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_1/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_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49104-49105


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

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