Mercurial > hg > nginx-tests
comparison fastcgi_request_buffering_chunked.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 | 1e79a9613813 |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
42 | 42 |
43 http { | 43 http { |
44 %%TEST_GLOBALS_HTTP%% | 44 %%TEST_GLOBALS_HTTP%% |
45 | 45 |
46 server { | 46 server { |
47 listen 127.0.0.1:%%PORT_0%%; | 47 listen 127.0.0.1:8080; |
48 server_name localhost; | 48 server_name localhost; |
49 | 49 |
50 client_header_buffer_size 1k; | 50 client_header_buffer_size 1k; |
51 fastcgi_request_buffering off; | 51 fastcgi_request_buffering off; |
52 fastcgi_param REQUEST_URI $request_uri; | 52 fastcgi_param REQUEST_URI $request_uri; |
53 | 53 |
54 location / { | 54 location / { |
55 client_body_buffer_size 2k; | 55 client_body_buffer_size 2k; |
56 fastcgi_pass 127.0.0.1:%%PORT_1%%; | 56 fastcgi_pass 127.0.0.1:8081; |
57 } | 57 } |
58 location /single { | 58 location /single { |
59 client_body_in_single_buffer on; | 59 client_body_in_single_buffer on; |
60 fastcgi_pass 127.0.0.1:%%PORT_1%%; | 60 fastcgi_pass 127.0.0.1:8081; |
61 } | 61 } |
62 location /preread { | 62 location /preread { |
63 fastcgi_pass 127.0.0.1:%%PORT_2%%; | 63 fastcgi_pass 127.0.0.1:8082; |
64 } | 64 } |
65 location /error_page { | 65 location /error_page { |
66 fastcgi_pass 127.0.0.1:%%PORT_1%%; | 66 fastcgi_pass 127.0.0.1:8081; |
67 error_page 404 /404; | 67 error_page 404 /404; |
68 fastcgi_intercept_errors on; | 68 fastcgi_intercept_errors on; |
69 } | 69 } |
70 location /404 { | 70 location /404 { |
71 return 200 "$request_body\n"; | 71 return 200 "$request_body\n"; |
74 } | 74 } |
75 | 75 |
76 EOF | 76 EOF |
77 | 77 |
78 $t->run_daemon(\&fastcgi_daemon); | 78 $t->run_daemon(\&fastcgi_daemon); |
79 $t->run()->waitforsocket('127.0.0.1:' . port(1)); | 79 $t->run()->waitforsocket('127.0.0.1:' . port(8081)); |
80 | 80 |
81 ############################################################################### | 81 ############################################################################### |
82 | 82 |
83 like(http_get('/'), qr/X-Body: \x0d\x0a?/ms, 'no body'); | 83 like(http_get('/'), qr/X-Body: \x0d\x0a?/ms, 'no body'); |
84 | 84 |
101 like(http_get_body('/', '0123456789' x 128, '0123456789' x 512, '0123456789', | 101 like(http_get_body('/', '0123456789' x 128, '0123456789' x 512, '0123456789', |
102 'foobar'), qr/X-Body: foobar\x0d?$/ms, 'body pipelined 2'); | 102 'foobar'), qr/X-Body: foobar\x0d?$/ms, 'body pipelined 2'); |
103 | 103 |
104 # interactive tests | 104 # interactive tests |
105 | 105 |
106 my $s = get_body('/preread', port(2)); | 106 my $s = get_body('/preread', port(8082)); |
107 ok($s, 'no preread'); | 107 ok($s, 'no preread'); |
108 | 108 |
109 SKIP: { | 109 SKIP: { |
110 skip 'no preread failed', 3 unless $s; | 110 skip 'no preread failed', 3 unless $s; |
111 | 111 |
114 | 114 |
115 like($s->{http_end}(), qr/200 OK/, 'no preread - response'); | 115 like($s->{http_end}(), qr/200 OK/, 'no preread - response'); |
116 | 116 |
117 } | 117 } |
118 | 118 |
119 $s = get_body('/preread', port(2), '01234'); | 119 $s = get_body('/preread', port(8082), '01234'); |
120 ok($s, 'preread'); | 120 ok($s, 'preread'); |
121 | 121 |
122 SKIP: { | 122 SKIP: { |
123 skip 'preread failed', 3 unless $s; | 123 skip 'preread failed', 3 unless $s; |
124 | 124 |
127 | 127 |
128 like($s->{http_end}(), qr/200 OK/, 'preread - response'); | 128 like($s->{http_end}(), qr/200 OK/, 'preread - response'); |
129 | 129 |
130 } | 130 } |
131 | 131 |
132 $s = get_body('/preread', port(2), '01234', many => 1); | 132 $s = get_body('/preread', port(8082), '01234', many => 1); |
133 ok($s, 'chunks'); | 133 ok($s, 'chunks'); |
134 | 134 |
135 SKIP: { | 135 SKIP: { |
136 skip 'chunks failed', 3 unless $s; | 136 skip 'chunks failed', 3 unless $s; |
137 | 137 |
384 sub log2c { Test::Nginx::log_core('||', @_); } | 384 sub log2c { Test::Nginx::log_core('||', @_); } |
385 | 385 |
386 ############################################################################### | 386 ############################################################################### |
387 | 387 |
388 sub fastcgi_daemon { | 388 sub fastcgi_daemon { |
389 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(1), 5); | 389 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(8081), 5); |
390 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, | 390 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, |
391 $socket); | 391 $socket); |
392 | 392 |
393 my $count; | 393 my $count; |
394 my ($body, $buf); | 394 my ($body, $buf); |