# HG changeset patch # User Sergey Kandaurov # Date 1617882664 -10800 # Node ID 0c1bd4c23c95f86396c43e0198e2688acb5d769b # Parent bdebd63dbab37144f8b13a1a67a14c7bff161d93 Tests: $connection_requests and $connection_time tests. diff --git a/h2_max_requests.t b/h2_max_requests.t --- a/h2_max_requests.t +++ b/h2_max_requests.t @@ -63,6 +63,8 @@ http { keepalive_time 1s; + add_header X-Conn $connection_requests:$connection_time; + location / { } } } @@ -75,7 +77,7 @@ EOF # suppress deprecation warning open OLDERR, ">&", \*STDERR; close STDERR; -$t->try_run('no keepalive_time')->plan(17); +$t->try_run('no keepalive_time')->plan(19); open STDERR, ">&", \*OLDERR; ############################################################################### @@ -158,6 +160,7 @@ ok($frame, 'keepalive_timeout 0 - GOAWAY ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}->{':status'}, 200, 'keepalive time request'); +like($frame->{headers}->{'x-conn'}, qr/^1:0/, 'keepalive time variables'); $frames = $s->read(all => [{ type => 'GOAWAY' }], wait => 0.5); @@ -171,6 +174,7 @@ select undef, undef, undef, 1.1; ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}->{':status'}, 200, 'keepalive time request 2'); +like($frame->{headers}->{'x-conn'}, qr/^2:[^0]/, 'keepalive time variables 2'); ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; ok($frame, 'keepalive time limit - GOAWAY'); diff --git a/http_keepalive.t b/http_keepalive.t --- a/http_keepalive.t +++ b/http_keepalive.t @@ -49,6 +49,8 @@ http { keepalive_requests 2; keepalive_timeout 1 9; + add_header X-Conn $connection_requests:$connection_time; + location / { } location /r { keepalive_requests 4; @@ -83,7 +85,7 @@ EOF $t->write_file('safari', ''); $t->write_file('none', ''); $t->write_file('zero', ''); -$t->try_run('no keepalive_time')->plan(20); +$t->try_run('no keepalive_time')->plan(21); ############################################################################### @@ -127,6 +129,8 @@ unlike($r, qr/Connection: close/, 'keepa is(() = $r =~ /(200 OK)/g, 2, 'keepalive time limit requests'); like($r, qr/Connection: close/, 'keepalive time limit connection'); +like($r, qr/X-Conn: 1:0.*X-Conn: 2:[^0]/s, 'keepalive time limit variables'); + # cancel keepalive on EOF while discarding body my $s = http(< 1);