comparison h2.t @ 685:fdc748de6fad

Tests: updated HTTP/2 tests for malformed requests. Removed tests for the optional RFC7540 functionality no longer implemented, updated TODOs for the mandatory part now implemented in the HTTP/2 patch.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 08 Sep 2015 21:19:35 +0300
parents 96666f621dbc
children 3f4a132c6463
comparison
equal deleted inserted replaced
684:96666f621dbc 685:fdc748de6fad
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(178); 35 ->has_daemon('openssl')->plan(177);
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
1579 1579
1580 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 1580 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1581 isnt($frame->{headers}->{'x-referer'}, 'see-this', 'newline in request header'); 1581 isnt($frame->{headers}->{'x-referer'}, 'see-this', 'newline in request header');
1582 1582
1583 # 8.1.2.6. Malformed Requests and Responses 1583 # 8.1.2.6. Malformed Requests and Responses
1584 # For malformed requests, a server MAY send an HTTP response prior to
1585 # closing or resetting the stream.
1586
1587 is($frame->{headers}->{':status'}, 400, 'newline in request header - status');
1588
1589 # 8.1.2.6. Malformed Requests and Responses
1590 # Malformed requests or responses that are detected MUST be treated 1584 # Malformed requests or responses that are detected MUST be treated
1591 # as a stream error (Section 5.4.2) of type PROTOCOL_ERROR. 1585 # as a stream error (Section 5.4.2) of type PROTOCOL_ERROR.
1592
1593 TODO: {
1594 local $TODO = 'not yet';
1595 1586
1596 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; 1587 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
1597 is($frame->{sid}, $sid, 'newline in request header - RST_STREAM sid'); 1588 is($frame->{sid}, $sid, 'newline in request header - RST_STREAM sid');
1598 is($frame->{length}, 4, 'newline in request header - RST_STREAM length'); 1589 is($frame->{length}, 4, 'newline in request header - RST_STREAM length');
1599 is($frame->{flags}, 0, 'newline in request header - RST_STREAM flags'); 1590 is($frame->{flags}, 0, 'newline in request header - RST_STREAM flags');
1600 is($frame->{code}, 1, 'newline in request header - RST_STREAM code'); 1591 is($frame->{code}, 1, 'newline in request header - RST_STREAM code');
1601
1602 }
1603 1592
1604 # GOAWAY on SYN_STREAM with even StreamID 1593 # GOAWAY on SYN_STREAM with even StreamID
1605 1594
1606 TODO: { 1595 TODO: {
1607 local $TODO = 'not yet'; 1596 local $TODO = 'not yet';