Mercurial > hg > nginx-tests
comparison fastcgi.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 |
---|---|
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(6) | 28 my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(7) |
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; |
35 events { | 35 events { |
36 } | 36 } |
37 | 37 |
38 http { | 38 http { |
39 %%TEST_GLOBALS_HTTP%% | 39 %%TEST_GLOBALS_HTTP%% |
40 | |
41 upstream u { | |
42 server 127.0.0.1:8081; | |
43 } | |
40 | 44 |
41 server { | 45 server { |
42 listen 127.0.0.1:8080; | 46 listen 127.0.0.1:8080; |
43 server_name localhost; | 47 server_name localhost; |
44 | 48 |
68 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); | 72 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); |
69 | 73 |
70 like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled'); | 74 like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled'); |
71 | 75 |
72 like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'fastcgi with variables'); | 76 like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'fastcgi with variables'); |
77 like(http_get('/var?b=u'), qr/SEE-THIS/, 'fastcgi with variables to upstream'); | |
73 | 78 |
74 ############################################################################### | 79 ############################################################################### |
75 | 80 |
76 sub fastcgi_daemon { | 81 sub fastcgi_daemon { |
77 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5); | 82 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5); |