]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/httpd-corner.psgi
qspawn: retry sysread when parsing headers, too
[public-inbox.git] / t / httpd-corner.psgi
index f8396907f2b25da4211d17396bde3cccae0ba712..9728aa05a0aa081f6c4b4bf7f23d7bcb27b25656 100644 (file)
@@ -72,6 +72,19 @@ my $app = sub {
                        getline => sub { undef },
                        close => sub { die 'CLOSE FAIL' },
                );
+       } elsif ($path eq '/async-big') {
+               require PublicInbox::Qspawn;
+               open my $null, '>', '/dev/null' or die;
+               my $rdr = { 2 => fileno($null) };
+               my $cmd = [qw(dd if=/dev/zero count=30 bs=1024k)];
+               my $qsp = PublicInbox::Qspawn->new($cmd, undef, $rdr);
+               return $qsp->psgi_return($env, undef, sub {
+                       my ($r, $bref) = @_;
+                       # make $rd_hdr retry sysread + $parse_hdr in Qspawn:
+                       return until length($$bref) > 8000;
+                       close $null;
+                       [ 200, [ qw(Content-Type application/octet-stream) ]];
+               });
        }
 
        [ $code, $h, $body ]