diff -Nru ruby-webrick-1.7.0/debian/changelog ruby-webrick-1.7.0/debian/changelog --- ruby-webrick-1.7.0/debian/changelog 2021-11-17 08:12:45.000000000 +0000 +++ ruby-webrick-1.7.0/debian/changelog 2021-11-28 13:56:56.000000000 +0000 @@ -1,6 +1,14 @@ +ruby-webrick (1.7.0-3) unstable; urgency=medium + + * Add upstream commit to revert "Allow empty POST and PUT requests without + content length". This was causing failures in ruby-httpclient testsuite. + * Remove trailing space in a previous changelog entry + + -- Cédric Boutillier Sun, 28 Nov 2021 14:56:56 +0100 + ruby-webrick (1.7.0-2) unstable; urgency=medium - * Source-only upload to comply with migration rules to testing + * Source-only upload to comply with migration rules to testing -- Cédric Boutillier Wed, 17 Nov 2021 09:12:45 +0100 diff -Nru ruby-webrick-1.7.0/debian/patches/0001-Revert-Allow-empty-POST-and-PUT-requests-without-con.patch ruby-webrick-1.7.0/debian/patches/0001-Revert-Allow-empty-POST-and-PUT-requests-without-con.patch --- ruby-webrick-1.7.0/debian/patches/0001-Revert-Allow-empty-POST-and-PUT-requests-without-con.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-webrick-1.7.0/debian/patches/0001-Revert-Allow-empty-POST-and-PUT-requests-without-con.patch 2021-11-28 13:56:56.000000000 +0000 @@ -0,0 +1,51 @@ +From: Jeremy Evans +Date: Tue, 2 Mar 2021 07:30:54 -0800 +Subject: Revert "Allow empty POST and PUT requests without content length" + +This reverts commit 069e9b1908aad3a30a0dcf67b6d3bb13c3216d2c. + +Users reports this causes WEBrick to block forever if receiving a +POST/PUT request with an empty body. +Bug: https://github.com/ruby/webrick/issues/67 +Origin: https://github.com/ruby/webrick/commit/f87aec09fce09c142d2aa5108987338114327e4c.patch +--- + lib/webrick/httprequest.rb | 2 +- + test/webrick/test_httprequest.rb | 12 ------------ + 2 files changed, 1 insertion(+), 13 deletions(-) + +diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb +index d34eac7..d1f0889 100644 +--- a/lib/webrick/httprequest.rb ++++ b/lib/webrick/httprequest.rb +@@ -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 +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 / + 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_ diff -Nru ruby-webrick-1.7.0/debian/patches/series ruby-webrick-1.7.0/debian/patches/series --- ruby-webrick-1.7.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ ruby-webrick-1.7.0/debian/patches/series 2021-11-28 13:56:56.000000000 +0000 @@ -0,0 +1 @@ +0001-Revert-Allow-empty-POST-and-PUT-requests-without-con.patch