comparison h2.t @ 781:d0a3444c21a6

Tests: added HTTP/2 test for invalid header name (ticket #831).
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 13 Nov 2015 01:51:02 +0300
parents ca2db52ae97f
children 37396c3bc097
comparison
equal deleted inserted replaced
780:5a0bba53854b 781:d0a3444c21a6
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(286); 35 ->has_daemon('openssl')->plan(287);
36 36
37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL 37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL
38 38
39 $t->todo_alerts(); 39 $t->todo_alerts();
40 40
2710 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; 2710 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
2711 is($frame->{sid}, $sid, 'newline in request header - RST_STREAM sid'); 2711 is($frame->{sid}, $sid, 'newline in request header - RST_STREAM sid');
2712 is($frame->{length}, 4, 'newline in request header - RST_STREAM length'); 2712 is($frame->{length}, 4, 'newline in request header - RST_STREAM length');
2713 is($frame->{flags}, 0, 'newline in request header - RST_STREAM flags'); 2713 is($frame->{flags}, 0, 'newline in request header - RST_STREAM flags');
2714 is($frame->{code}, 1, 'newline in request header - RST_STREAM code'); 2714 is($frame->{code}, 1, 'newline in request header - RST_STREAM code');
2715
2716 # invalid header name as seen with underscore should not lead to ignoring rest
2717
2718 TODO: {
2719 local $TODO = 'not yet';
2720
2721 $sess = new_session();
2722 $sid = new_stream($sess, { headers => [
2723 { name => ':method', value => 'GET', mode => 0 },
2724 { name => ':scheme', value => 'http', mode => 0 },
2725 { name => ':path', value => '/', mode => 0 },
2726 { name => ':authority', value => 'localhost', mode => 1 },
2727 { name => 'x_foo', value => "x-bar", mode => 2 },
2728 { name => 'referer', value => "see-this", mode => 1 }]});
2729 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
2730
2731 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
2732 is($frame->{headers}->{'x-referer'}, 'see-this', 'after invalid header name');
2733
2734 }
2715 2735
2716 # GOAWAY on SYN_STREAM with even StreamID 2736 # GOAWAY on SYN_STREAM with even StreamID
2717 2737
2718 $sess = new_session(); 2738 $sess = new_session();
2719 new_stream($sess, { path => '/' }, 2); 2739 new_stream($sess, { path => '/' }, 2);