avoid open3() since it could get in deadlocks
@@ -48,9 +48,9 @@ subtest "http/2" => sub {
my $fetch = sub {
my ($server, $path) = @_;
my $cmd = "exec @{[bindir]}/picotls/cli -I -s $tempdir/session -e 127.0.0.1 $server->{tls_port} > $tempdir/resp.txt";
- my $pid = open my $fh, "|-", $cmd
+ my $pid = open my $child_in, "|-", $cmd
or die "failed to invoke command:$cmd:$!";
- autoflush $fh 1;
+ autoflush $child_in 1;
# send request
my $hpack_str = sub { chr(length $_[0]) . $_[0] };
my $hpack_hdr = sub { "\x10" . $hpack_str->($_[0]) . $hpack_str->($_[1]) };
@@ -60,15 +60,16 @@ subtest "http/2" => sub {
$hpack_hdr->(":authority", "127.0.0.1"),
$hpack_hdr->(":path", $path),
);
- syswrite $fh, join '', (
+ syswrite $child_in, join '', (
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n", # preface
"\x00\x00\x00\x04\x00\x00\x00\x00\x00", # SETTINGS
"\x00\x00@{[chr length $hpack]}\x01\x05\x00\x00\x00\x01$hpack", # HEADERS
);
- # do not wait for idle-timeout
- sleep 3;
- kill 'KILL', $pid;
- open $fh, "<", "$tempdir/resp.txt"
+ close $child_in;
+
+ waitpid $pid, 0;
+
+ open my $fh, "<", "$tempdir/resp.txt"
or die "failed to open file:$tempdir/resp.txt:$!";
do { local $/; <$fh> };
};
@@ -86,6 +87,7 @@ sub run_tests {
my $do_test = shift;
# spawn server
my $server = spawn_h2o(<< "EOT");
+http2-idle-timeout: 1
num-threads: 1
hosts:
default:
