Mercurial > hg > nginx-tests
comparison proxy.t @ 732:984bfe661cce
Tests: stream and http proxy_connect_timeout tests.
The proxy_connect_timeout timer should be disabled after socket was connected.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 05 Oct 2015 13:19:45 +0300 |
parents | cf9183219c59 |
children | 122cd3a82367 |
comparison
equal
deleted
inserted
replaced
731:cf9183219c59 | 732:984bfe661cce |
---|---|
19 ############################################################################### | 19 ############################################################################### |
20 | 20 |
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(4); | 24 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(5); |
25 | 25 |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | 26 $t->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
40 server_name localhost; | 40 server_name localhost; |
41 | 41 |
42 location / { | 42 location / { |
43 proxy_pass http://127.0.0.1:8081; | 43 proxy_pass http://127.0.0.1:8081; |
44 proxy_read_timeout 1s; | 44 proxy_read_timeout 1s; |
45 proxy_connect_timeout 1s; | |
45 } | 46 } |
46 | 47 |
47 location /var { | 48 location /var { |
48 proxy_pass http://$arg_b; | 49 proxy_pass http://$arg_b; |
49 proxy_read_timeout 1s; | 50 proxy_read_timeout 1s; |
62 like(http_get('/multi'), qr/AND-THIS/, 'proxy request with multiple packets'); | 63 like(http_get('/multi'), qr/AND-THIS/, 'proxy request with multiple packets'); |
63 | 64 |
64 unlike(http_head('/'), qr/SEE-THIS/, 'proxy head request'); | 65 unlike(http_head('/'), qr/SEE-THIS/, 'proxy head request'); |
65 | 66 |
66 like(http_get('/var?b=127.0.0.1:8081/'), qr/SEE-THIS/, 'proxy with variables'); | 67 like(http_get('/var?b=127.0.0.1:8081/'), qr/SEE-THIS/, 'proxy with variables'); |
68 | |
69 my $s = http('', start => 1); | |
70 | |
71 sleep 2; | |
72 | |
73 like(http_get('/', socket => $s), qr/200 OK/, 'proxy connect timeout'); | |
67 | 74 |
68 ############################################################################### | 75 ############################################################################### |
69 | 76 |
70 sub http_daemon { | 77 sub http_daemon { |
71 my $server = IO::Socket::INET->new( | 78 my $server = IO::Socket::INET->new( |