Mercurial > hg > nginx-tests
comparison h2.t @ 1182:83c88a830a45
Tests: added HTTP/2 SETTINGS test with multiple parameters.
The test ensures that all parameters are applied before emitting new frames.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 06 Jun 2017 14:55:26 +0300 |
parents | ec9ddfed9b63 |
children | 878696cb8510 |
comparison
equal
deleted
inserted
replaced
1181:eb813f7e0bfa | 1182:83c88a830a45 |
---|---|
24 | 24 |
25 select STDERR; $| = 1; | 25 select STDERR; $| = 1; |
26 select STDOUT; $| = 1; | 26 select STDOUT; $| = 1; |
27 | 27 |
28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/) | 28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/) |
29 ->plan(140); | 29 ->plan(141); |
30 | 30 |
31 $t->write_file_expand('nginx.conf', <<'EOF'); | 31 $t->write_file_expand('nginx.conf', <<'EOF'); |
32 | 32 |
33 %%TEST_GLOBALS%% | 33 %%TEST_GLOBALS%% |
34 | 34 |
833 | 833 |
834 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); | 834 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
835 @data = grep { $_->{type} eq "DATA" } @$frames; | 835 @data = grep { $_->{type} eq "DATA" } @$frames; |
836 is($data[0]->{length}, 2**15, 'max frame size - custom'); | 836 is($data[0]->{length}, 2**15, 'max frame size - custom'); |
837 | 837 |
838 # SETTINGS_INITIAL_WINDOW_SIZE + SETTINGS_MAX_FRAME_SIZE | |
839 # Expanding available stream window should not result in emitting | |
840 # new frames before remaining SETTINGS parameters were applied. | |
841 | |
842 TODO: { | |
843 local $TODO = 'not yet' unless $t->has_version('1.13.2'); | |
844 | |
845 $s = Test::Nginx::HTTP2->new(); | |
846 $s->h2_window(2**17); | |
847 $s->h2_settings(0, 0x4 => 42); | |
848 | |
849 $sid = $s->new_stream({ path => '/frame_size' }); | |
850 | |
851 $s->h2_settings(0, 0x4 => 2**17, 0x5 => 2**15); | |
852 | |
853 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); | |
854 @data = grep { $_->{type} eq "DATA" } @$frames; | |
855 $lengths = join ' ', map { $_->{length} } @data; | |
856 is($lengths, '42 32768 32768 38', 'multiple SETTINGS'); | |
857 | |
858 } | |
859 | |
838 # stream multiplexing + WINDOW_UPDATE | 860 # stream multiplexing + WINDOW_UPDATE |
839 | 861 |
840 $s = Test::Nginx::HTTP2->new(); | 862 $s = Test::Nginx::HTTP2->new(); |
841 $sid = $s->new_stream({ path => '/t1.html' }); | 863 $sid = $s->new_stream({ path => '/t1.html' }); |
842 $frames = $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]); | 864 $frames = $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]); |