Mercurial > hg > nginx-tests
comparison body.t @ 252:8b554d26eb1a
Tests: client_body_in_file_only with proxy test.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 28 Jan 2013 15:25:28 +0400 |
parents | 6a0d934950bc |
children | 0cc5269bc62c |
comparison
equal
deleted
inserted
replaced
251:df984d23f9d1 | 252:8b554d26eb1a |
---|---|
20 ############################################################################### | 20 ############################################################################### |
21 | 21 |
22 select STDERR; $| = 1; | 22 select STDERR; $| = 1; |
23 select STDOUT; $| = 1; | 23 select STDOUT; $| = 1; |
24 | 24 |
25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(10); | 25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(11); |
26 | 26 |
27 $t->write_file_expand('nginx.conf', <<'EOF'); | 27 $t->write_file_expand('nginx.conf', <<'EOF'); |
28 | 28 |
29 %%TEST_GLOBALS%% | 29 %%TEST_GLOBALS%% |
30 | 30 |
52 client_body_buffer_size 2k; | 52 client_body_buffer_size 2k; |
53 client_body_in_file_only on; | 53 client_body_in_file_only on; |
54 add_header X-Body "$request_body"; | 54 add_header X-Body "$request_body"; |
55 add_header X-Body-File "$request_body_file"; | 55 add_header X-Body-File "$request_body_file"; |
56 proxy_pass http://127.0.0.1:8081; | 56 proxy_pass http://127.0.0.1:8081; |
57 } | |
58 location /small { | |
59 client_body_in_file_only on; | |
60 proxy_pass http://127.0.0.1:8080/; | |
57 } | 61 } |
58 location /single { | 62 location /single { |
59 client_body_in_single_buffer on; | 63 client_body_in_single_buffer on; |
60 add_header X-Body "$request_body"; | 64 add_header X-Body "$request_body"; |
61 add_header X-Body-File "$request_body_file"; | 65 add_header X-Body-File "$request_body_file"; |
111 'body discard'); | 115 'body discard'); |
112 like(http_get_body('/discard', '0123456789' x 128, '0123456789' x 512, | 116 like(http_get_body('/discard', '0123456789' x 128, '0123456789' x 512, |
113 '0123456789', 'foobar'), qr/(TEST.*){4}/ms, | 117 '0123456789', 'foobar'), qr/(TEST.*){4}/ms, |
114 'body discard 2'); | 118 'body discard 2'); |
115 | 119 |
120 TODO: { | |
121 local $TODO = 'broken by 1.3.9'; | |
122 | |
123 # proxy with file only | |
124 | |
125 like(http_get_body('/small', '0123456789'), | |
126 qr/X-Body: 0123456789\x0d?$/ms, 'small body in file only'); | |
127 | |
128 } | |
129 | |
116 ############################################################################### | 130 ############################################################################### |
117 | 131 |
118 sub read_body_file { | 132 sub read_body_file { |
119 my ($r) = @_; | 133 my ($r) = @_; |
120 return '' unless $r =~ m/X-Body-File: (.*)/; | 134 return '' unless $r =~ m/X-Body-File: (.*)/; |