changeset 1668:0c1bd4c23c95

Tests: $connection_requests and $connection_time tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 08 Apr 2021 14:51:04 +0300
parents bdebd63dbab3
children 03cf423ea140
files h2_max_requests.t http_keepalive.t
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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');
--- 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(<<EOF, start => 1);