I found myself tempted to switch to HTTP::Tiny, here, since
it's distributed with Perl since 5.14, unlike Net::HTTP
(which AFAIK was never a part of Perl proper).
But we really want to use Net::HTTP, here, since it's
lower-level and allows us to trigger server-side buffering
by not reading the entity body.
# Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+#
+# Ensure buffering behavior in -httpd doesn't cause runaway memory use
+# or data corruption
use strict;
use warnings;
use Test::More;
use strict;
use warnings;
use Test::More;
my ($code, $mess, %h) = $http->read_response_headers;
is(200, $code, 'got 200 success for pack');
is($max, $h{'Content-Length'}, 'got expected Content-Length for pack');
my ($code, $mess, %h) = $http->read_response_headers;
is(200, $code, 'got 200 success for pack');
is($max, $h{'Content-Length'}, 'got expected Content-Length for pack');
+
+ # no $http->read_entity_body, here, since we want to force buffering
foreach my $i (1..3) {
sleep 1;
my $diff = $get_maxrss->() - $mem_a;
foreach my $i (1..3) {
sleep 1;
my $diff = $get_maxrss->() - $mem_a;