1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert "[ruby/webrick] Allow empty POST and PUT requests without content length"

This reverts commit ed12019ce6.

  https://github.com/ruby/ruby/runs/1160423667?check_suite_focus=true#step:14:752
This commit is contained in:
Hiroshi SHIBATA 2020-09-24 22:18:13 +09:00
parent 588ac990ff
commit 757e185cee
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 1 additions and 13 deletions

View file

@ -522,7 +522,7 @@ module WEBrick
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

View file

@ -425,18 +425,6 @@ GET /
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_