comparison h2_request_body.t @ 886:af2cd0ba6ca7

Tests: fixed HTTP/2 test for empty request body proxied with https. The test was broken with splitting h2.t due to missing ssl_certificate. Break the test out into a separate file as it depends on openssl binary.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 25 Mar 2016 22:19:54 +0300
parents a6abbfed42c0
children 4ab795ab2e62
comparison
equal deleted inserted replaced
885:a1e76cca714c 886:af2cd0ba6ca7
21 ############################################################################### 21 ###############################################################################
22 22
23 select STDERR; $| = 1; 23 select STDERR; $| = 1;
24 select STDOUT; $| = 1; 24 select STDOUT; $| = 1;
25 25
26 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy/)->plan(35); 26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(34);
27
28 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL
29 27
30 $t->todo_alerts(); 28 $t->todo_alerts();
31 29
32 $t->write_file_expand('nginx.conf', <<'EOF'); 30 $t->write_file_expand('nginx.conf', <<'EOF');
33 31
42 %%TEST_GLOBALS_HTTP%% 40 %%TEST_GLOBALS_HTTP%%
43 41
44 server { 42 server {
45 listen 127.0.0.1:8080 http2; 43 listen 127.0.0.1:8080 http2;
46 listen 127.0.0.1:8081; 44 listen 127.0.0.1:8081;
47 listen 127.0.0.1:8082 ssl;
48 server_name localhost; 45 server_name localhost;
49 46
50 location / { } 47 location / { }
51 location /proxy2/ { 48 location /proxy2/ {
52 add_header X-Body $request_body; 49 add_header X-Body $request_body;
53 add_header X-Body-File $request_body_file; 50 add_header X-Body-File $request_body_file;
54 client_body_in_file_only on; 51 client_body_in_file_only on;
55 proxy_pass http://127.0.0.1:8081/; 52 proxy_pass http://127.0.0.1:8081/;
56 }
57 location /proxy_ssl/ {
58 proxy_pass https://127.0.0.1:8082/;
59 } 53 }
60 location /client_max_body_size { 54 location /client_max_body_size {
61 add_header X-Body $request_body; 55 add_header X-Body $request_body;
62 add_header X-Body-File $request_body_file; 56 add_header X-Body-File $request_body_file;
63 client_body_in_single_buffer on; 57 client_body_in_single_buffer on;
151 is(read_body_file($frame->{headers}{'x-body-file'}), '', 145 is(read_body_file($frame->{headers}{'x-body-file'}), '',
152 'request body - empty content'); 146 'request body - empty content');
153 147
154 } 148 }
155 149
156 # same as above but proxied to ssl backend
157
158 TODO: {
159 local $TODO = 'not yet';
160
161 $sess = new_session();
162 $sid = new_stream($sess, { path => '/proxy_ssl/', body_more => 1 });
163 h2_body($sess, '');
164 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
165
166 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
167 is($frame->{headers}->{':status'}, 200, 'request body - empty - proxy ssl');
168
169 }
170
171 # malformed request body length not equal to content-length 150 # malformed request body length not equal to content-length
172 151
173 $sess = new_session(); 152 $sess = new_session();
174 $sid = new_stream($sess, 153 $sid = new_stream($sess,
175 { body_more => 1, headers => [ 154 { body_more => 1, headers => [