Changeset 1550:5c96745988c4 in nginx-tests


Ignore:
Timestamp:
02/07/20 14:21:46 (11 days ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Phase:
public
Tags:
tip
Message:

Tests: added HTTP/2 test for invalid index in literal header field.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • h2_headers.t

    r1549 r1550  
    2424select STDOUT; $| = 1;
    2525
    26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite/)->plan(103)
     26my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite/)->plan(104)
    2727        ->write_file_expand('nginx.conf', <<'EOF');
    2828
     
    471471$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
    472472
    473 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
    474 is($frame, undef, 'invalid index');
     473($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
     474is($frame->{code}, 0x9, 'invalid index');
     475
     476$s = Test::Nginx::HTTP2->new();
     477$sid = $s->new_stream({ headers => [
     478        { name => ':method', value => 'GET', mode => 0 },
     479        { name => ':scheme', value => 'http', mode => 0 },
     480        { name => ':path', value => '/', mode => 0 },
     481        { name => ':authority', value => 'localhost', mode => 1 },
     482        { name => 'unknown', value => 'foo', mode => 3 }]});
     483$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
     484
     485($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
     486is($frame->{code}, 0x9, 'invalid index in literal header field');
    475487
    476488# 5.4.1.  Connection Error Handling
Note: See TracChangeset for help on using the changeset viewer.