comparison h2.t @ 675:42de9efd11ee

Tests: added HTTP/2 test for request header with newline.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 04 Sep 2015 14:45:15 +0300
parents 9d6c865c2869
children 5d258aa5ebc5
comparison
equal deleted inserted replaced
674:2d10f958741d 675:42de9efd11ee
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(162); 35 ->has_daemon('openssl')->plan(163);
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
1417 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames; 1417 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames;
1418 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 3'); 1418 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 3');
1419 1419
1420 1420
1421 # some invalid cases below 1421 # some invalid cases below
1422
1423 # ensure that request header field value with newline doesn't get split
1424
1425 $sess = new_session();
1426 $sid = new_stream($sess, { headers => [
1427 { name => ':method', value => 'GET', mode => 0 },
1428 { name => ':scheme', value => 'http', mode => 0 },
1429 { name => ':path', value => '/proxy2/', mode => 1 },
1430 { name => ':authority', value => 'localhost', mode => 1 },
1431 { name => 'x-foo', value => "x-bar\r\nreferer:see-this", mode => 2 }]});
1432 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1433
1434 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1435 isnt($frame->{headers}->{'x-referer'}, 'see-this', 'newline in request header');
1422 1436
1423 # GOAWAY on SYN_STREAM with even StreamID 1437 # GOAWAY on SYN_STREAM with even StreamID
1424 1438
1425 TODO: { 1439 TODO: {
1426 local $TODO = 'not yet'; 1440 local $TODO = 'not yet';