Mercurial > hg > nginx-tests
comparison fastcgi_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 | 1e79a9613813 |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
41 | 41 |
42 http { | 42 http { |
43 %%TEST_GLOBALS_HTTP%% | 43 %%TEST_GLOBALS_HTTP%% |
44 | 44 |
45 server { | 45 server { |
46 listen 127.0.0.1:%%PORT_0%%; | 46 listen 127.0.0.1:8080; |
47 server_name localhost; | 47 server_name localhost; |
48 | 48 |
49 client_header_buffer_size 1k; | 49 client_header_buffer_size 1k; |
50 fastcgi_request_buffering off; | 50 fastcgi_request_buffering off; |
51 fastcgi_param REQUEST_URI $request_uri; | 51 fastcgi_param REQUEST_URI $request_uri; |
52 fastcgi_param CONTENT_LENGTH $content_length; | 52 fastcgi_param CONTENT_LENGTH $content_length; |
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), 10); | 106 my $s = get_body('/preread', port(8082), 10); |
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), 10, '01234'); | 119 $s = get_body('/preread', port(8082), 10, '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 |
339 sub log2c { Test::Nginx::log_core('||', @_); } | 339 sub log2c { Test::Nginx::log_core('||', @_); } |
340 | 340 |
341 ############################################################################### | 341 ############################################################################### |
342 | 342 |
343 sub fastcgi_daemon { | 343 sub fastcgi_daemon { |
344 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(1), 5); | 344 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(8081), 5); |
345 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, | 345 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, |
346 $socket); | 346 $socket); |
347 | 347 |
348 my $count; | 348 my $count; |
349 my $body; | 349 my $body; |