Mercurial > hg > nginx-tests
comparison fastcgi.t @ 1463:5ac92857e419
Tests: fastcgi_catch_stderr test.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 11 Apr 2019 20:12:24 +0300 |
parents | 882267679006 |
children |
comparison
equal
deleted
inserted
replaced
1462:fe886814b25a | 1463:5ac92857e419 |
---|---|
23 | 23 |
24 eval { require FCGI; }; | 24 eval { require FCGI; }; |
25 plan(skip_all => 'FCGI not installed') if $@; | 25 plan(skip_all => 'FCGI not installed') if $@; |
26 plan(skip_all => 'win32') if $^O eq 'MSWin32'; | 26 plan(skip_all => 'win32') if $^O eq 'MSWin32'; |
27 | 27 |
28 my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(7) | 28 my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(8) |
29 ->write_file_expand('nginx.conf', <<'EOF'); | 29 ->write_file_expand('nginx.conf', <<'EOF'); |
30 | 30 |
31 %%TEST_GLOBALS%% | 31 %%TEST_GLOBALS%% |
32 | 32 |
33 daemon off; | 33 daemon off; |
49 location / { | 49 location / { |
50 fastcgi_pass 127.0.0.1:8081; | 50 fastcgi_pass 127.0.0.1:8081; |
51 fastcgi_param REQUEST_URI $request_uri; | 51 fastcgi_param REQUEST_URI $request_uri; |
52 } | 52 } |
53 | 53 |
54 location /catch { | |
55 fastcgi_pass 127.0.0.1:8081; | |
56 fastcgi_param REQUEST_URI "/stderr"; | |
57 fastcgi_catch_stderr sample; | |
58 } | |
59 | |
54 location /var { | 60 location /var { |
55 fastcgi_pass $arg_b; | 61 fastcgi_pass $arg_b; |
56 fastcgi_param REQUEST_URI $request_uri; | 62 fastcgi_param REQUEST_URI $request_uri; |
57 } | 63 } |
58 } | 64 } |
70 like(http_get('/'), qr/^3$/m, 'fastcgi third request'); | 76 like(http_get('/'), qr/^3$/m, 'fastcgi third request'); |
71 | 77 |
72 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); | 78 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); |
73 | 79 |
74 like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled'); | 80 like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled'); |
81 like(http_get('/catch'), qr/502 Bad/, 'catch stderr'); | |
75 | 82 |
76 like(http_get('/var?b=127.0.0.1:' . port(8081)), qr/SEE-THIS/, | 83 like(http_get('/var?b=127.0.0.1:' . port(8081)), qr/SEE-THIS/, |
77 'fastcgi with variables'); | 84 'fastcgi with variables'); |
78 like(http_get('/var?b=u'), qr/SEE-THIS/, 'fastcgi with variables to upstream'); | 85 like(http_get('/var?b=u'), qr/SEE-THIS/, 'fastcgi with variables to upstream'); |
79 | 86 |