Changeset 1286:b50c8b9a7644 in nginx-tests


Ignore:
Timestamp:
02/14/18 12:10:55 (2 years ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Phase:
public
Message:

Tests: added HTTP/2 $request_length tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • h2_variables.t

    r974 r1286  
    2424select STDOUT; $| = 1;
    2525
    26 my $t = Test::Nginx->new()->has(qw/http http_v2 rewrite/)->plan(4)
     26my $t = Test::Nginx->new()->has(qw/http http_v2 rewrite/)->plan(6)
    2727        ->write_file_expand('nginx.conf', <<'EOF');
    2828
     
    5252        location /https {
    5353            return 200 $https;
     54        }
     55        location /rl {
     56            return 200 $request_length;
    5457        }
    5558    }
     
    98101is($frame->{data}, '', 'https variable');
    99102
     103# $request_length, HEADERS payload length
     104
     105$s = Test::Nginx::HTTP2->new();
     106$sid = $s->new_stream({ headers => [
     107        { name => ':method', value => 'GET', mode => 0 },               # 1
     108        { name => ':scheme', value => 'http', mode => 0 },              # 1
     109        { name => ':authority', value => 'localhost', mode => 1 },      # 1+1+9
     110        { name => ':path', value => '/rl', mode => 1 }]});              # 1+1+3
     111$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
     112
     113($frame) = grep { $_->{type} eq "DATA" } @$frames;
     114is($frame->{data}, '18', 'request length');
     115
     116# $request_length, HEADERS+CONTINUATION payload length
     117
     118$s = Test::Nginx::HTTP2->new();
     119$sid = $s->new_stream({ continuation => 1, headers => [
     120        { name => ':method', value => 'GET', mode => 0 },               # 1
     121        { name => ':authority', value => 'localhost', mode => 1 },      # 1+1+9
     122        { name => ':path', value => '/rl', mode => 1 }]});              # 1+1+3
     123$s->h2_continue($sid, { headers => [
     124        { name => ':scheme', value => 'http', mode => 0 }]});           # 1
     125$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
     126
     127($frame) = grep { $_->{type} eq "DATA" } @$frames;
     128is($frame->{data}, '18', 'request length');
     129
    100130###############################################################################
Note: See TracChangeset for help on using the changeset viewer.