Mercurial > hg > nginx-tests
comparison fastcgi.t @ 801:d95c4b8e5517
Tests: more tests for passing requests to host given by expression.
This complements tests for scgi_pass, fastcgi_pass, uwsgi_pass with variables
that evaluate to an implicit upstream.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 09 Dec 2015 18:59:26 +0300 |
parents | d5bf5942a8b2 |
children | eca9b1d19021 |
comparison
equal
deleted
inserted
replaced
800:51d3243a762f | 801:d95c4b8e5517 |
---|---|
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(5) | 28 my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(6) |
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; |
44 | 44 |
45 location / { | 45 location / { |
46 fastcgi_pass 127.0.0.1:8081; | 46 fastcgi_pass 127.0.0.1:8081; |
47 fastcgi_param REQUEST_URI $request_uri; | 47 fastcgi_param REQUEST_URI $request_uri; |
48 } | 48 } |
49 | |
50 location /var { | |
51 fastcgi_pass $arg_b; | |
52 fastcgi_param REQUEST_URI $request_uri; | |
53 } | |
49 } | 54 } |
50 } | 55 } |
51 | 56 |
52 EOF | 57 EOF |
53 | 58 |
61 like(http_get('/'), qr/^3$/m, 'fastcgi third request'); | 66 like(http_get('/'), qr/^3$/m, 'fastcgi third request'); |
62 | 67 |
63 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); | 68 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); |
64 | 69 |
65 like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled'); | 70 like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled'); |
71 | |
72 like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'fastcgi with variables'); | |
66 | 73 |
67 ############################################################################### | 74 ############################################################################### |
68 | 75 |
69 sub fastcgi_daemon { | 76 sub fastcgi_daemon { |
70 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5); | 77 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5); |