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

ruby-changes:63076

From: Hiroshi <ko1@a...>
Date: Thu, 24 Sep 2020 22:20:23 +0900 (JST)
Subject: [ruby-changes:63076] 757e185cee (master): Revert "[ruby/webrick] Allow empty POST and PUT requests without content length"

https://git.ruby-lang.org/ruby.git/commit/?id=757e185cee

From 757e185cee44c627f9e573c926fd73843f81006b Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Thu, 24 Sep 2020 22:18:13 +0900
Subject: Revert "[ruby/webrick] Allow empty POST and PUT requests without
 content length"

  This reverts commit ed12019ce6abe87aac87ec77ac081d37b25180a2.

  https://github.com/ruby/ruby/runs/1160423667?check_suite_focus=true#step:14:752

diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb
index 294bd91..c781797 100644
--- a/lib/webrick/httprequest.rb
+++ b/lib/webrick/httprequest.rb
@@ -522,7 +522,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httprequest.rb#L522
         if @remaining_size > 0 && @socket.eof?
           raise HTTPStatus::BadRequest, "invalid body size."
         end
-      elsif BODY_CONTAINABLE_METHODS.member?(@request_method) && !@socket.eof
+      elsif BODY_CONTAINABLE_METHODS.member?(@request_method)
         raise HTTPStatus::LengthRequired
       end
       return @body
diff --git a/test/webrick/test_httprequest.rb b/test/webrick/test_httprequest.rb
index 759ccbd..a594f14 100644
--- a/test/webrick/test_httprequest.rb
+++ b/test/webrick/test_httprequest.rb
@@ -425,18 +425,6 @@ GET / https://github.com/ruby/ruby/blob/trunk/test/webrick/test_httprequest.rb#L425
     assert_equal l, msg.size
   end
 
-  def test_empty_post
-    msg = <<-_end_of_message_
-      POST /path?foo=x;foo=y;foo=z;bar=1 HTTP/1.1
-      Host: test.ruby-lang.org:8080
-      Content-Type: application/x-www-form-urlencoded
-
-    _end_of_message_
-    req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
-    req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
-    req.body
-  end
-
   def test_bad_messages
     param = "foo=1;foo=2;foo=3;bar=x"
     msg = <<-_end_of_message_
-- 
cgit v0.10.2


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

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