comparison h2.t @ 672:66f94d6c5047

Tests: more HTTP/2 error handling tests. Make sure that, besides GOAWAY, connection is closed on a connection error.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 02 Sep 2015 17:37:48 +0300
parents 0c70eb166a3a
children 9d6c865c2869
comparison
equal deleted inserted replaced
671:0c70eb166a3a 672:66f94d6c5047
30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); }; 30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
31 plan(skip_all => 'IO::Socket::SSL too old') if $@; 31 plan(skip_all => 'IO::Socket::SSL too old') if $@;
32 32
33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) 33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/)
34 ->has(qw/limit_conn rewrite realip shmem/) 34 ->has(qw/limit_conn rewrite realip shmem/)
35 ->has_daemon('openssl')->plan(159); 35 ->has_daemon('openssl')->plan(161);
36 36
37 $t->write_file_expand('nginx.conf', <<'EOF'); 37 $t->write_file_expand('nginx.conf', <<'EOF');
38 38
39 %%TEST_GLOBALS%% 39 %%TEST_GLOBALS%%
40 40
494 { name => ':authority', value => 'localhost', mode => 1 }, 494 { name => ':authority', value => 'localhost', mode => 1 },
495 { name => 'referer', value => 'foo', mode => 0 }]}); 495 { name => 'referer', value => 'foo', mode => 0 }]});
496 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); 496 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
497 497
498 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 498 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
499 is($frame, undef, 'updated table size - invalid index'); 499 is($frame, undef, 'invalid index');
500 500
501 # 5.4.1. Connection Error Handling 501 # 5.4.1. Connection Error Handling
502 # An endpoint that encounters a connection error SHOULD first send a 502 # An endpoint that encounters a connection error SHOULD first send a
503 # GOAWAY frame <..> 503 # GOAWAY frame <..>
504 504
505 TODO: { 505 TODO: {
506 local $TODO = 'not yet'; 506 local $TODO = 'not yet';
507 507
508 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; 508 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
509 ok($frame, 'updated table size - invalid index GOAWAY'); 509 ok($frame, 'invalid index - GOAWAY');
510 510
511 } 511 }
512
513 h2_ping($sess, 'SEE-THIS');
514 is(@{h2_read($sess, all => [{ type => 'PING' }])}, 0, 'invalid index - PING');
515 is($sess->{socket}->connected, undef, 'invalid index - connection close');
512 516
513 # HEAD 517 # HEAD
514 518
515 $sess = new_session(); 519 $sess = new_session();
516 $sid = new_stream($sess, { method => 'HEAD' }); 520 $sid = new_stream($sess, { method => 'HEAD' });