comparison h2.t @ 673:9d6c865c2869

Tests: HTTP/2 regression test for empty authority request header.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 02 Sep 2015 19:03:24 +0300
parents 66f94d6c5047
children 42de9efd11ee
comparison
equal deleted inserted replaced
672:66f94d6c5047 673:9d6c865c2869
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(161); 35 ->has_daemon('openssl')->plan(162);
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
1492 1492
1493 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 1493 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1494 is($frame->{headers}->{':status'}, 400, 'incomplete headers'); 1494 is($frame->{headers}->{':status'}, 400, 'incomplete headers');
1495 1495
1496 } 1496 }
1497
1498 # empty request header ':authority'
1499
1500 $sess = new_session();
1501 $sid = new_stream($sess, { headers => [
1502 { name => ':method', value => 'GET', mode => 0 },
1503 { name => ':scheme', value => 'http', mode => 0 },
1504 { name => ':path', value => '/', mode => 0 },
1505 { name => ':authority', value => '', mode => 0 }]});
1506 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1507
1508 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1509 is($frame->{headers}->{':status'}, 400, 'empty authority');
1497 1510
1498 # GOAWAY - force closing a connection by server 1511 # GOAWAY - force closing a connection by server
1499 1512
1500 $sid = new_stream($sess, { path => 't1.html' }); 1513 $sid = new_stream($sess, { path => 't1.html' });
1501 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]); 1514 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);