comparison h2.t @ 831:c384a2e53c1b

Tests: respect HTTP/2 header compression, related improvements.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 27 Jan 2016 19:56:04 +0300
parents 3d12316e6f41
children 04eb968b0987
comparison
equal deleted inserted replaced
830:3d12316e6f41 831:c384a2e53c1b
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(300); 35 ->has_daemon('openssl')->plan(301);
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
2049 ok($frame, 'response header - parts'); 2049 ok($frame, 'response header - parts');
2050 2050
2051 SKIP: { 2051 SKIP: {
2052 skip 'response header failed', 1 unless $frame; 2052 skip 'response header failed', 1 unless $frame;
2053 2053
2054 ok(join('', @{$frame->{headers}->{'x-longheader'}}) eq 'x' x 2**15 x 3, 2054 is(length join('', @{$frame->{headers}->{'x-longheader'}}), 98304,
2055 'response header - headers'); 2055 'response header - headers');
2056 2056
2057 } 2057 }
2058 2058
2059 # response header block split and sent in parts 2059 # response header block split and sent in parts
2060
2061 SKIP: {
2062 skip 'broken by header compression', 1 unless $ENV{TEST_NGINX_UNSAFE};
2063 2060
2064 $sess = new_session(8092); 2061 $sess = new_session(8092);
2065 $sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**15 }); 2062 $sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**15 });
2066 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]); 2063 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
2067 2064
2068 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames; 2065 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames;
2069 $lengths = join ' ', map { $_->{length} } @data; 2066 ($lengths) = sort { $b <=> $a } map { $_->{length} } @data;
2070 like($lengths, qr/16384 16384 16384 16384 16384 16384 \d+/, 2067 cmp_ok($lengths, '<=', 16384, 'response header split - max size');
2071 'response header split - parts'); 2068
2072 2069 is(length join('', @{@$frames[-1]->{headers}->{'x-longheader'}}), 98304,
2073 } 2070 'response header split - headers');
2074 2071
2075 } 2072 }
2076 2073
2077 # max_field_size - header field name 2074 # max_field_size - header field name
2078 2075