Mercurial > hg > nginx-tests
comparison h2.t @ 680:85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 08 Sep 2015 15:12:23 +0300 |
parents | b60c1a207675 |
children | 96666f621dbc |
comparison
equal
deleted
inserted
replaced
679:b60c1a207675 | 680:85e368105c8b |
---|---|
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(168); | 35 ->has_daemon('openssl')->plan(170); |
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 |
73 } | 73 } |
74 location /gzip.html { | 74 location /gzip.html { |
75 gzip on; | 75 gzip on; |
76 gzip_min_length 0; | 76 gzip_min_length 0; |
77 alias %%TESTDIR%%/t2.html; | 77 alias %%TESTDIR%%/t2.html; |
78 } | |
79 location /frame_size { | |
80 http2_chunk_size 64k; | |
81 alias %%TESTDIR%%/t1.html; | |
82 output_buffers 2 1m; | |
78 } | 83 } |
79 location /pp { | 84 location /pp { |
80 set_real_ip_from 127.0.0.1/32; | 85 set_real_ip_from 127.0.0.1/32; |
81 real_ip_header proxy_protocol; | 86 real_ip_header proxy_protocol; |
82 alias %%TESTDIR%%/t2.html; | 87 alias %%TESTDIR%%/t2.html; |
1040 | 1045 |
1041 $frames = h2_read($sess, all => [{ sid => $sid, length => 1 }]); | 1046 $frames = h2_read($sess, all => [{ sid => $sid, length => 1 }]); |
1042 is(@$frames, 1, 'positive window'); | 1047 is(@$frames, 1, 'positive window'); |
1043 is(@$frames[0]->{type}, 'DATA', 'positive window - data'); | 1048 is(@$frames[0]->{type}, 'DATA', 'positive window - data'); |
1044 is(@$frames[0]->{length}, 1, 'positive window - data length'); | 1049 is(@$frames[0]->{length}, 1, 'positive window - data length'); |
1050 | |
1051 # SETTINGS_MAX_FRAME_SIZE | |
1052 | |
1053 $sess = new_session(); | |
1054 $sid = new_stream($sess, { path => '/frame_size' }); | |
1055 h2_window($sess, 2**18, 1); | |
1056 h2_window($sess, 2**18); | |
1057 | |
1058 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | |
1059 @data = grep { $_->{type} eq "DATA" } @$frames; | |
1060 is($data[0]->{length}, 2**14, 'max frame size - default'); | |
1061 | |
1062 $sess = new_session(); | |
1063 h2_settings($sess, 0, 0x5 => 2**15); | |
1064 $sid = new_stream($sess, { path => '/frame_size' }); | |
1065 h2_window($sess, 2**18, 1); | |
1066 h2_window($sess, 2**18); | |
1067 | |
1068 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | |
1069 @data = grep { $_->{type} eq "DATA" } @$frames; | |
1070 is($data[0]->{length}, 2**15, 'max frame size - custom'); | |
1045 | 1071 |
1046 # stream multiplexing + WINDOW_UPDATE | 1072 # stream multiplexing + WINDOW_UPDATE |
1047 | 1073 |
1048 $sess = new_session(); | 1074 $sess = new_session(); |
1049 $sid = new_stream($sess, { path => '/t1.html' }); | 1075 $sid = new_stream($sess, { path => '/t1.html' }); |