changeset 651:9f66f0029dca

Tests: HTTP/2 tests for http2_chunk_size directive.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 18 Aug 2015 18:10:23 +0300
parents 8a2cf558b8ae
children 5a85ad9382a3
files h2.t
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/h2.t
+++ b/h2.t
@@ -32,7 +32,7 @@ plan(skip_all => 'IO::Socket::SSL too ol
 
 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/)
 	->has(qw/limit_conn rewrite realip shmem/)
-	->has_daemon('openssl')->plan(142);
+	->has_daemon('openssl')->plan(145);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -85,6 +85,10 @@ http {
         location /h2 {
             return 200 $http2;
         }
+        location /chunk_size {
+            http2_chunk_size 1;
+            return 200 'body';
+        }
         location /redirect {
             error_page 405 /;
             return 405;
@@ -568,6 +572,17 @@ is($frame->{data}, 'h2', 'http variable 
 
 }
 
+# http2_chunk_size=1
+
+$sess = new_session();
+$sid = new_stream($sess, { path => '/chunk_size' });
+$frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
+
+my @data = grep { $_->{type} eq "DATA" } @$frames;
+is(@data, 4, 'chunk_size frames');
+is(join(' ', map { $_->{data} } @data), 'b o d y', 'chunk_size data');
+is(join(' ', map { $_->{flags} } @data), '0 0 0 1', 'chunk_size flags');
+
 # CONTINUATION
 
 $sess = new_session();
@@ -907,7 +922,7 @@ is($frame->{headers}->{':status'}, '200'
 
 # with the default http2_chunk_size, data is divided into 8 data frames
 
-my @data = grep { $_->{type} eq "DATA" } @$frames;
+@data = grep { $_->{type} eq "DATA" } @$frames;
 my $lengths = join ' ', map { $_->{length} } @data;
 is($lengths, '8192 8192 8192 8192 8192 8192 8192 8191',
 	'iws - stream blocked on initial window size');