comparison h2.t @ 846:9b5e1c5f0240

Tests: added HTTP/2 test with charset.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 05 Feb 2016 17:40:56 +0300
parents e31f1b5bb569
children 7de036e89770
comparison
equal deleted inserted replaced
845:e31f1b5bb569 846:9b5e1c5f0240
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(306); 35 ->has_daemon('openssl')->plan(307);
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
188 add_header X-Cookie $http_cookie; 188 add_header X-Cookie $http_cookie;
189 add_header X-Cookie-a $cookie_a; 189 add_header X-Cookie-a $cookie_a;
190 add_header X-Cookie-c $cookie_c; 190 add_header X-Cookie-c $cookie_c;
191 return 200; 191 return 200;
192 } 192 }
193 location /charset {
194 charset utf-8;
195 return 200;
196 }
193 } 197 }
194 198
195 server { 199 server {
196 listen 127.0.0.1:8085 http2; 200 listen 127.0.0.1:8085 http2;
197 server_name localhost; 201 server_name localhost;
1348 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 1352 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1349 is($frame->{headers}->{'content-encoding'}, 'gzip', 'gzip - encoding'); 1353 is($frame->{headers}->{'content-encoding'}, 'gzip', 'gzip - encoding');
1350 1354
1351 ($frame) = grep { $_->{type} eq "DATA" } @$frames; 1355 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
1352 gunzip_like($frame->{data}, qr/^SEE-THIS\Z/, 'gzip - DATA'); 1356 gunzip_like($frame->{data}, qr/^SEE-THIS\Z/, 'gzip - DATA');
1357
1358 # charset
1359
1360 $sess = new_session();
1361 $sid = new_stream($sess, { path => '/charset' });
1362 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1363
1364 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1365 is($frame->{headers}->{'content-type'}, 'text/plain; charset=utf-8', 'charset');
1353 1366
1354 # simple proxy cache test 1367 # simple proxy cache test
1355 1368
1356 $sess = new_session(); 1369 $sess = new_session();
1357 $sid = new_stream($sess, { path => '/cache/t4.html' }); 1370 $sid = new_stream($sess, { path => '/cache/t4.html' });