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

ruby-changes:40604

From: hsbt <ko1@a...>
Date: Fri, 20 Nov 2015 14:57:21 +0900 (JST)
Subject: [ruby-changes:40604] hsbt:r52683 (trunk): * lib/net/http.rb: Fixed regression for Net::HTTP::PUT with "Expect-100"

hsbt	2015-11-20 14:57:10 +0900 (Fri, 20 Nov 2015)

  New Revision: 52683

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

  Log:
    * lib/net/http.rb: Fixed regression for Net::HTTP::PUT with "Expect-100"
      header.
    * test/net/http/test_http.rb: added test.

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/http.rb
    trunk/test/net/http/test_http.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52682)
+++ ChangeLog	(revision 52683)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov 20 14:57:01 2015  Trevor Rowe  <trevorrowe@g...>
+
+	* lib/net/http.rb: Fixed regression for Net::HTTP::PUT with "Expect-100"
+	  header.
+	* test/net/http/test_http.rb: added test.
+
 Fri Nov 20 14:39:56 2015  SHIBATA Hiroshi  <hsbt@r...>
 
 	* lib/net/http.rb: set hostname before call ossl_ssl_set_session.
Index: lib/net/http.rb
===================================================================
--- lib/net/http.rb	(revision 52682)
+++ lib/net/http.rb	(revision 52683)
@@ -1439,11 +1439,11 @@ module Net   #:nodoc: https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L1439
 
           res.uri = req.uri
 
-          res.reading_body(@socket, req.response_body_permitted?) {
-            yield res if block_given?
-          }
           res
         }
+        res.reading_body(@socket, req.response_body_permitted?) {
+          yield res if block_given?
+        }
       rescue Net::OpenTimeout
         raise
       rescue Net::ReadTimeout, IOError, EOFError,
Index: test/net/http/test_http.rb
===================================================================
--- test/net/http/test_http.rb	(revision 52682)
+++ test/net/http/test_http.rb	(revision 52683)
@@ -838,6 +838,22 @@ class TestNetHTTPContinue < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L838
     assert_not_match(/HTTP\/1.1 100 continue/, @debug.string)
   end
 
+  def test_expect_continue_error_before_body
+    @log_tester = nil
+    mount_proc {|req, res|
+      raise WEBrick::HTTPStatus::Forbidden
+    }
+    start {|http|
+      uheader = {'content-length' => '5', 'expect' => '100-continue'}
+      http.continue_timeout = 1 # allow the server to respond before sending
+      http.request_post('/continue', 'data', uheader) {|res|
+        assert_equal(res.code, '403')
+      }
+    }
+    assert_match(/Expect: 100-continue/, @debug.string)
+    assert_not_match(/HTTP\/1.1 100 continue/, @debug.string)
+  end
+
   def test_expect_continue_error_while_waiting
     mount_proc {|req, res|
       res.status = 501

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

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