comparison body_chunked.t @ 269:970bb423e59f

Tests: proxy_next_upstream tests in body.t, body_chunked.t.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 12 Mar 2013 20:07:25 +0400
parents 6a0d934950bc
children a9621dbbd0d4
comparison
equal deleted inserted replaced
268:8dac281ff522 269:970bb423e59f
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(9); 25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(10);
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
33 events { 33 events {
34 } 34 }
35 35
36 http { 36 http {
37 %%TEST_GLOBALS_HTTP%% 37 %%TEST_GLOBALS_HTTP%%
38
39 upstream u {
40 server 127.0.0.1:8082;
41 server 127.0.0.1:8080 backup;
42 }
38 43
39 server { 44 server {
40 listen 127.0.0.1:8080; 45 listen 127.0.0.1:8080;
41 server_name localhost; 46 server_name localhost;
42 47
62 proxy_pass http://127.0.0.1:8081; 67 proxy_pass http://127.0.0.1:8081;
63 } 68 }
64 location /discard { 69 location /discard {
65 return 200 "TEST\n"; 70 return 200 "TEST\n";
66 } 71 }
72 location /next {
73 proxy_pass http://u/;
74 }
67 } 75 }
68 76
69 server { 77 server {
70 listen 127.0.0.1:8081; 78 listen 127.0.0.1:8081;
71 server_name localhost; 79 server_name localhost;
72 80
73 location / { 81 location / {
74 return 200 "TEST\n"; 82 return 200 "TEST\n";
83 }
84 }
85
86 server {
87 listen 127.0.0.1:8082;
88 server_name localhost;
89
90 location / {
91 return 444;
75 } 92 }
76 } 93 }
77 } 94 }
78 95
79 EOF 96 EOF
112 'chunked body discard'); 129 'chunked body discard');
113 like(http_get_body('/discard', '0123456789' x 128, '0123456789' x 512, 130 like(http_get_body('/discard', '0123456789' x 128, '0123456789' x 512,
114 '0123456789', 'foobar'), qr/(TEST.*){4}/ms, 131 '0123456789', 'foobar'), qr/(TEST.*){4}/ms,
115 'chunked body discard 2'); 132 'chunked body discard 2');
116 133
134 # proxy_next_upstream
135
136 like(http_get_body('/next', '0123456789'),
137 qr/X-Body: 0123456789\x0d?$/ms, 'body chunked next upstream');
138
117 } 139 }
118 140
119 ############################################################################### 141 ###############################################################################
120 142
121 sub read_body_file { 143 sub read_body_file {