comparison proxy_request_buffering.t @ 974:882267679006

Tests: simplified parallel modifications in tests. Mail tests were simplified in c227348453db.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 12 Jul 2016 17:39:03 +0300
parents e9064d691790
children
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
37 37
38 http { 38 http {
39 %%TEST_GLOBALS_HTTP%% 39 %%TEST_GLOBALS_HTTP%%
40 40
41 server { 41 server {
42 listen 127.0.0.1:%%PORT_0%%; 42 listen 127.0.0.1:8080;
43 server_name localhost; 43 server_name localhost;
44 44
45 client_header_buffer_size 1k; 45 client_header_buffer_size 1k;
46 proxy_request_buffering off; 46 proxy_request_buffering off;
47 47
48 location / { 48 location / {
49 client_body_buffer_size 2k; 49 client_body_buffer_size 2k;
50 add_header X-Body "$request_body"; 50 add_header X-Body "$request_body";
51 proxy_pass http://127.0.0.1:%%PORT_1%%; 51 proxy_pass http://127.0.0.1:8081;
52 } 52 }
53 location /small { 53 location /small {
54 client_body_in_file_only on; 54 client_body_in_file_only on;
55 proxy_pass http://127.0.0.1:%%PORT_0%%/; 55 proxy_pass http://127.0.0.1:8080/;
56 } 56 }
57 location /single { 57 location /single {
58 client_body_in_single_buffer on; 58 client_body_in_single_buffer on;
59 add_header X-Body "$request_body"; 59 add_header X-Body "$request_body";
60 proxy_pass http://127.0.0.1:%%PORT_1%%; 60 proxy_pass http://127.0.0.1:8081;
61 } 61 }
62 location /discard { 62 location /discard {
63 return 200 "TEST\n"; 63 return 200 "TEST\n";
64 } 64 }
65 location /preread { 65 location /preread {
66 proxy_pass http://127.0.0.1:%%PORT_2%%/; 66 proxy_pass http://127.0.0.1:8082/;
67 } 67 }
68 location /error_page { 68 location /error_page {
69 proxy_pass http://127.0.0.1:%%PORT_1%%/404; 69 proxy_pass http://127.0.0.1:8081/404;
70 error_page 404 /404; 70 error_page 404 /404;
71 proxy_intercept_errors on; 71 proxy_intercept_errors on;
72 } 72 }
73 location /404 { 73 location /404 {
74 return 200 "$request_body\n"; 74 return 200 "$request_body\n";
75 } 75 }
76 } 76 }
77 77
78 server { 78 server {
79 listen 127.0.0.1:%%PORT_1%%; 79 listen 127.0.0.1:8081;
80 server_name localhost; 80 server_name localhost;
81 81
82 location / { 82 location / {
83 proxy_pass http://127.0.0.1:%%PORT_0%%/discard; 83 proxy_pass http://127.0.0.1:8080/discard;
84 } 84 }
85 location /404 { } 85 location /404 { }
86 } 86 }
87 } 87 }
88 88
125 like(http_get_body('/small', '0123456789'), 125 like(http_get_body('/small', '0123456789'),
126 qr/X-Body: 0123456789\x0d?$/ms, 'small body in file only'); 126 qr/X-Body: 0123456789\x0d?$/ms, 'small body in file only');
127 127
128 # interactive tests 128 # interactive tests
129 129
130 my $s = get_body('/preread', port(2), 10); 130 my $s = get_body('/preread', port(8082), 10);
131 ok($s, 'no preread'); 131 ok($s, 'no preread');
132 132
133 SKIP: { 133 SKIP: {
134 skip 'no preread failed', 3 unless $s; 134 skip 'no preread failed', 3 unless $s;
135 135
138 138
139 like($s->{http_end}(), qr/200 OK/, 'no preread - response'); 139 like($s->{http_end}(), qr/200 OK/, 'no preread - response');
140 140
141 } 141 }
142 142
143 $s = get_body('/preread', port(2), 10, '01234'); 143 $s = get_body('/preread', port(8082), 10, '01234');
144 ok($s, 'preread'); 144 ok($s, 'preread');
145 145
146 SKIP: { 146 SKIP: {
147 skip 'preread failed', 3 unless $s; 147 skip 'preread failed', 3 unless $s;
148 148