comparison h2.t @ 1710:f3de5730bc06

Tests: CONNECT and TRACE method tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 29 Jun 2021 11:57:38 +0300
parents 5ac6efbe5552
children 26252394dd58
comparison
equal deleted inserted replaced
1709:9fac05e479fa 1710:f3de5730bc06
24 24
25 select STDERR; $| = 1; 25 select STDERR; $| = 1;
26 select STDOUT; $| = 1; 26 select STDOUT; $| = 1;
27 27
28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/) 28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/)
29 ->plan(142); 29 ->plan(144);
30 30
31 $t->write_file_expand('nginx.conf', <<'EOF'); 31 $t->write_file_expand('nginx.conf', <<'EOF');
32 32
33 %%TEST_GLOBALS%% 33 %%TEST_GLOBALS%%
34 34
296 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEAD - HEADERS header'); 296 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEAD - HEADERS header');
297 297
298 ($frame) = grep { $_->{type} eq "DATA" } @$frames; 298 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
299 is($frame, undef, 'HEAD - no body'); 299 is($frame, undef, 'HEAD - no body');
300 300
301 # CONNECT
302
303 TODO: {
304 local $TODO = 'not yet' unless $t->has_version('1.21.1');
305
306 $s = Test::Nginx::HTTP2->new();
307 $sid = $s->new_stream({ method => 'CONNECT' });
308 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
309
310 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
311 is($frame->{headers}->{':status'}, 405, 'CONNECT - not allowed');
312
313 }
314
315 # TRACE
316
317 $s = Test::Nginx::HTTP2->new();
318 $sid = $s->new_stream({ method => 'TRACE' });
319 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
320
321 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
322 is($frame->{headers}->{':status'}, 405, 'TRACE - not allowed');
323
301 # range filter 324 # range filter
302 325
303 $s = Test::Nginx::HTTP2->new(); 326 $s = Test::Nginx::HTTP2->new();
304 $sid = $s->new_stream({ headers => [ 327 $sid = $s->new_stream({ headers => [
305 { name => ':method', value => 'GET', mode => 0 }, 328 { name => ':method', value => 'GET', mode => 0 },