comparison h2_max_requests.t @ 1657:22e0133d68b4

Tests: added HTTP/2 test with "keepalive_timeout 0" (ticket #2142).
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 01 Mar 2021 20:03:40 +0300
parents 21f511a7f5c3
children bdebd63dbab3
comparison
equal deleted inserted replaced
1656:759efa4abc76 1657:22e0133d68b4
45 http2_max_requests 2; 45 http2_max_requests 2;
46 keepalive_requests 2; 46 keepalive_requests 2;
47 47
48 location / { } 48 location / { }
49 } 49 }
50
51 server {
52 listen 127.0.0.1:8081 http2;
53 server_name localhost;
54
55 keepalive_timeout 0;
56
57 location / { }
58 }
50 } 59 }
51 60
52 EOF 61 EOF
53 62
54 $t->write_file('index.html', 'SEE-THAT' x 50000); 63 $t->write_file('index.html', 'SEE-THAT' x 50000);
64 $t->write_file('t.html', 'SEE-THAT');
55 65
56 # suppress deprecation warning 66 # suppress deprecation warning
57 67
58 open OLDERR, ">&", \*STDERR; close STDERR; 68 open OLDERR, ">&", \*STDERR; close STDERR;
59 $t->run()->plan(10); 69 $t->run()->plan(12);
60 open STDERR, ">&", \*OLDERR; 70 open STDERR, ">&", \*OLDERR;
61 71
62 ############################################################################### 72 ###############################################################################
63 73
64 my $s = Test::Nginx::HTTP2->new(); 74 my $s = Test::Nginx::HTTP2->new();
107 117
108 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; 118 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
109 ok($frame, 'max requests limited - GOAWAY'); 119 ok($frame, 'max requests limited - GOAWAY');
110 is($frame->{last_sid}, $sid, 'max requests limited - GOAWAY last stream'); 120 is($frame->{last_sid}, $sid, 'max requests limited - GOAWAY last stream');
111 121
122 # keepalive_timeout 0
123
124 SKIP: {
125 skip 'not yet', 2 unless $t->has_version('1.19.7');
126
127 $s = Test::Nginx::HTTP2->new(port(8081));
128 $sid = $s->new_stream({ path => '/t.html' });
129 $frames = $s->read(all => [{ sid => $sid, fin => 1 }, { type => 'GOAWAY' }]);
130
131 TODO: {
132 local $TODO = 'not yet' unless $t->has_version('1.19.8');
133
134 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
135 is($frame->{headers}->{':status'}, 200, 'keepalive_timeout 0');
136
137 }
138
139 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
140 ok($frame, 'keepalive_timeout 0 - GOAWAY');
141
142 }
143
112 # graceful shutdown in idle state 144 # graceful shutdown in idle state
113 145
114 $s = Test::Nginx::HTTP2->new(); 146 $s = Test::Nginx::HTTP2->new();
115 $s->{socket}->setsockopt(SOL_SOCKET, SO_RCVBUF, 64*1024) or die $!; 147 $s->{socket}->setsockopt(SOL_SOCKET, SO_RCVBUF, 64*1024) or die $!;
116 $s->h2_settings(0, 0x4 => 2**20); 148 $s->h2_settings(0, 0x4 => 2**20);