]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/git-http-backend.t
daemon: set TCP_DEFER_ACCEPT on everything but NNTP
[public-inbox.git] / t / git-http-backend.t
index b616e822bfb1fb5cfc2451673429eebce264a1c6..fc2d5462db345ee9638f59833b38b7737c5dd4c8 100644 (file)
@@ -1,24 +1,25 @@
 # 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 File::Temp qw/tempdir/;
-use IO::Socket;
-use Socket qw(SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY);
-use POSIX qw(dup2 setsid);
-use Cwd qw(getcwd);
+use IO::Socket::INET;
+use POSIX qw(setsid);
 
 my $git_dir = $ENV{GIANT_GIT_DIR};
 plan 'skip_all' => 'GIANT_GIT_DIR not defined' unless $git_dir;
-foreach my $mod (qw(PublicInbox::DS BSD::Resource
+foreach my $mod (qw(BSD::Resource
                        Plack::Util Plack::Builder
                        HTTP::Date HTTP::Status Net::HTTP)) {
        eval "require $mod";
        plan skip_all => "$mod missing for git-http-backend.t" if $@;
 }
 require './t/common.perl';
-my $psgi = getcwd()."/t/git-http-backend.psgi";
+my $psgi = "./t/git-http-backend.psgi";
 my $tmpdir = tempdir('pi-git-http-backend-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $err = "$tmpdir/stderr.log";
 my $out = "$tmpdir/stdout.log";
@@ -79,6 +80,8 @@ SKIP: {
        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;