comparison stream_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 824754da4afc
children 122cd3a82367
comparison
equal deleted inserted replaced
731:cf9183219c59 732:984bfe661cce
22 ############################################################################### 22 ###############################################################################
23 23
24 select STDERR; $| = 1; 24 select STDERR; $| = 1;
25 select STDOUT; $| = 1; 25 select STDOUT; $| = 1;
26 26
27 my $t = Test::Nginx->new()->has(qw/stream/)->plan(4) 27 my $t = Test::Nginx->new()->has(qw/stream/)->plan(5)
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;
60 stream_write($s, 'close'); 60 stream_write($s, 'close');
61 is(stream_read($s), 'close', 'proxy connection close'); 61 is(stream_read($s), 'close', 'proxy connection close');
62 62
63 stream_write($s, 'test'); 63 stream_write($s, 'test');
64 is(stream_read($s), '', 'proxy connection closed'); 64 is(stream_read($s), '', 'proxy connection closed');
65
66 $s = stream_connect();
67
68 sleep 2;
69
70 stream_write($s, 'foo');
71 is(stream_read($s), 'bar', 'proxy connect timeout');
65 72
66 ############################################################################### 73 ###############################################################################
67 74
68 sub stream_connect { 75 sub stream_connect {
69 my $peer = shift; 76 my $peer = shift;