comparison h2.t @ 859:63babcdd08db

Tests: HTTP/2 test with empty request body to ssl backend.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 26 Feb 2016 17:29:01 +0300
parents 75494fb00452
children cba4b1bccfd1
comparison
equal deleted inserted replaced
858:75494fb00452 859:63babcdd08db
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(316); 35 ->has_daemon('openssl')->plan(317);
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
58 listen 127.0.0.1:8080 http2; 58 listen 127.0.0.1:8080 http2;
59 listen 127.0.0.1:8081; 59 listen 127.0.0.1:8081;
60 listen 127.0.0.1:8082 proxy_protocol http2; 60 listen 127.0.0.1:8082 proxy_protocol http2;
61 listen 127.0.0.1:8084 http2 ssl; 61 listen 127.0.0.1:8084 http2 ssl;
62 listen 127.0.0.1:8092 http2 sndbuf=128; 62 listen 127.0.0.1:8092 http2 sndbuf=128;
63 listen 127.0.0.1:8094 ssl;
63 server_name localhost; 64 server_name localhost;
64 65
65 ssl_certificate_key localhost.key; 66 ssl_certificate_key localhost.key;
66 ssl_certificate localhost.crt; 67 ssl_certificate localhost.crt;
67 http2_max_field_size 128k; 68 http2_max_field_size 128k;
148 add_header X-Body "$request_body"; 149 add_header X-Body "$request_body";
149 add_header X-Body-File $request_body_file; 150 add_header X-Body-File $request_body_file;
150 client_body_in_file_only on; 151 client_body_in_file_only on;
151 proxy_pass http://127.0.0.1:8081/; 152 proxy_pass http://127.0.0.1:8081/;
152 } 153 }
154 location /proxy_ssl/ {
155 proxy_pass https://127.0.0.1:8094/;
156 }
153 location /limit_req { 157 location /limit_req {
154 limit_req zone=req burst=2; 158 limit_req zone=req burst=2;
155 alias %%TESTDIR%%/t2.html; 159 alias %%TESTDIR%%/t2.html;
156 } 160 }
157 location /proxy_limit_req/ { 161 location /proxy_limit_req/ {
1550 TODO: { 1554 TODO: {
1551 todo_skip 'empty body file', 1 unless $frame->{headers}{'x-body-file'}; 1555 todo_skip 'empty body file', 1 unless $frame->{headers}{'x-body-file'};
1552 1556
1553 is(read_body_file($frame->{headers}{'x-body-file'}), '', 1557 is(read_body_file($frame->{headers}{'x-body-file'}), '',
1554 'request body - empty content'); 1558 'request body - empty content');
1559
1560 }
1561
1562 # same as above but proxied to ssl backend
1563
1564 TODO: {
1565 local $TODO = 'not yet';
1566
1567 $sess = new_session();
1568 $sid = new_stream($sess, { path => '/proxy_ssl/', body_more => 1 });
1569 h2_body($sess, '');
1570 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1571
1572 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1573 is($frame->{headers}->{':status'}, 200, 'request body - empty - proxy ssl');
1555 1574
1556 } 1575 }
1557 1576
1558 # request body delayed in limit_req 1577 # request body delayed in limit_req
1559 1578