Mercurial > hg > nginx-tests
comparison scgi.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 | dc2f8aac0553 |
children | eca9b1d19021 |
comparison
equal
deleted
inserted
replaced
800:51d3243a762f | 801:d95c4b8e5517 |
---|---|
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 eval { require SCGI; }; | 24 eval { require SCGI; }; |
25 plan(skip_all => 'SCGI not installed') if $@; | 25 plan(skip_all => 'SCGI not installed') if $@; |
26 | 26 |
27 my $t = Test::Nginx->new()->has(qw/http scgi/)->plan(5) | 27 my $t = Test::Nginx->new()->has(qw/http scgi/)->plan(6) |
28 ->write_file_expand('nginx.conf', <<'EOF'); | 28 ->write_file_expand('nginx.conf', <<'EOF'); |
29 | 29 |
30 %%TEST_GLOBALS%% | 30 %%TEST_GLOBALS%% |
31 | 31 |
32 daemon off; | 32 daemon off; |
45 scgi_pass 127.0.0.1:8081; | 45 scgi_pass 127.0.0.1:8081; |
46 scgi_param SCGI 1; | 46 scgi_param SCGI 1; |
47 scgi_param REQUEST_URI $request_uri; | 47 scgi_param REQUEST_URI $request_uri; |
48 scgi_param HTTP_X_BLAH "blah"; | 48 scgi_param HTTP_X_BLAH "blah"; |
49 } | 49 } |
50 | |
51 location /var { | |
52 scgi_pass $arg_b; | |
53 scgi_param SCGI 1; | |
54 scgi_param REQUEST_URI $request_uri; | |
55 } | |
56 | |
50 } | 57 } |
51 } | 58 } |
52 | 59 |
53 EOF | 60 EOF |
54 | 61 |
63 | 70 |
64 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); | 71 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); |
65 | 72 |
66 like(http_get_headers('/headers'), qr/SEE-THIS/, | 73 like(http_get_headers('/headers'), qr/SEE-THIS/, |
67 'scgi request with many ignored headers'); | 74 'scgi request with many ignored headers'); |
75 | |
76 like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'scgi with variables'); | |
68 | 77 |
69 ############################################################################### | 78 ############################################################################### |
70 | 79 |
71 sub http_get_headers { | 80 sub http_get_headers { |
72 my ($url, %extra) = @_; | 81 my ($url, %extra) = @_; |