Mercurial > hg > nginx-tests
comparison scgi.t @ 802:eca9b1d19021
Tests: tests for host expansion to an explicit upstream.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 09 Dec 2015 19:00:41 +0300 |
parents | d95c4b8e5517 |
children | e9064d691790 |
comparison
equal
deleted
inserted
replaced
801:d95c4b8e5517 | 802:eca9b1d19021 |
---|---|
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(6) | 27 my $t = Test::Nginx->new()->has(qw/http scgi/)->plan(7) |
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; |
34 events { | 34 events { |
35 } | 35 } |
36 | 36 |
37 http { | 37 http { |
38 %%TEST_GLOBALS_HTTP%% | 38 %%TEST_GLOBALS_HTTP%% |
39 | |
40 upstream u { | |
41 server 127.0.0.1:8081; | |
42 } | |
39 | 43 |
40 server { | 44 server { |
41 listen 127.0.0.1:8080; | 45 listen 127.0.0.1:8080; |
42 server_name localhost; | 46 server_name localhost; |
43 | 47 |
72 | 76 |
73 like(http_get_headers('/headers'), qr/SEE-THIS/, | 77 like(http_get_headers('/headers'), qr/SEE-THIS/, |
74 'scgi request with many ignored headers'); | 78 'scgi request with many ignored headers'); |
75 | 79 |
76 like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'scgi with variables'); | 80 like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'scgi with variables'); |
81 like(http_get('/var?b=u'), qr/SEE-THIS/, 'scgi with variables to upstream'); | |
77 | 82 |
78 ############################################################################### | 83 ############################################################################### |
79 | 84 |
80 sub http_get_headers { | 85 sub http_get_headers { |
81 my ($url, %extra) = @_; | 86 my ($url, %extra) = @_; |