comparison lib/Test/Nginx/HTTP2.pm @ 1421:4e48bf51714f

Tests: aligned various generic read timeouts to http_end(). It was observed that previous timeout values could not be enough when making mass-building, in particular, when running with modsecurity.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 24 Dec 2018 14:24:51 +0300
parents 6404fd77f367
children 5b3d33b5556c
comparison
equal deleted inserted replaced
1420:ea593a9bab09 1421:4e48bf51714f
463 unpack 'N', pack 'xc3', unpack 'c3', $_[0]; 463 unpack 'N', pack 'xc3', unpack 'c3', $_[0];
464 } 464 }
465 465
466 sub raw_read { 466 sub raw_read {
467 my ($s, $buf, $len, $timo) = @_; 467 my ($s, $buf, $len, $timo) = @_;
468 $timo = 5 unless $timo; 468 $timo = 8 unless $timo;
469 my $got = ''; 469 my $got = '';
470 470
471 while (length($buf) < $len && IO::Select->new($s)->can_read($timo)) { 471 while (length($buf) < $len && IO::Select->new($s)->can_read($timo)) {
472 $s->sysread($got, 16384) or last; 472 $s->sysread($got, 16384) or last;
473 log_in($got); 473 log_in($got);
499 $port ||= port(8080); 499 $port ||= port(8080);
500 500
501 eval { 501 eval {
502 local $SIG{ALRM} = sub { die "timeout\n" }; 502 local $SIG{ALRM} = sub { die "timeout\n" };
503 local $SIG{PIPE} = sub { die "sigpipe\n" }; 503 local $SIG{PIPE} = sub { die "sigpipe\n" };
504 alarm(5); 504 alarm(8);
505 $s = IO::Socket::INET->new( 505 $s = IO::Socket::INET->new(
506 Proto => 'tcp', 506 Proto => 'tcp',
507 PeerAddr => "127.0.0.1:$port", 507 PeerAddr => "127.0.0.1:$port",
508 ); 508 );
509 require IO::Socket::SSL if $extra{'SSL'}; 509 require IO::Socket::SSL if $extra{'SSL'};