comparison stream_proxy_ssl.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 9208d8243926
children 3b25ee897439
comparison
equal deleted inserted replaced
731:cf9183219c59 732:984bfe661cce
21 21
22 select STDERR; $| = 1; 22 select STDERR; $| = 1;
23 select STDOUT; $| = 1; 23 select STDOUT; $| = 1;
24 24
25 my $t = Test::Nginx->new()->has(qw/stream stream_ssl http http_ssl/) 25 my $t = Test::Nginx->new()->has(qw/stream stream_ssl http http_ssl/)
26 ->has_daemon('openssl')->plan(4); 26 ->has_daemon('openssl')->plan(5);
27 27
28 $t->write_file_expand('nginx.conf', <<'EOF'); 28 $t->write_file_expand('nginx.conf', <<'EOF');
29 29
30 %%TEST_GLOBALS%% 30 %%TEST_GLOBALS%%
31 31
35 } 35 }
36 36
37 stream { 37 stream {
38 proxy_ssl on; 38 proxy_ssl on;
39 proxy_ssl_session_reuse on; 39 proxy_ssl_session_reuse on;
40 proxy_connect_timeout 1s;
40 41
41 server { 42 server {
42 listen 127.0.0.1:8080; 43 listen 127.0.0.1:8080;
43 proxy_pass 127.0.0.1:8087; 44 proxy_pass 127.0.0.1:8087;
44 proxy_ssl_session_reuse off; 45 proxy_ssl_session_reuse off;
101 like(http_get('/', socket => getconn('127.0.0.1:8080')), 102 like(http_get('/', socket => getconn('127.0.0.1:8080')),
102 qr/200 OK.*X-Session: \./s, 'ssl reuse session'); 103 qr/200 OK.*X-Session: \./s, 'ssl reuse session');
103 like(http_get('/', socket => getconn('127.0.0.1:8081')), 104 like(http_get('/', socket => getconn('127.0.0.1:8081')),
104 qr/200 OK.*X-Session: r/s, 'ssl reuse session 2'); 105 qr/200 OK.*X-Session: r/s, 'ssl reuse session 2');
105 106
107 my $s = http('', start => 1);
108
109 sleep 2;
110
111 my $r = http_get('/', socket => $s);
112
113 TODO: {
114 todo_skip 'not yet', 1 unless $r;
115
116 like($r, qr/200 OK/, 'proxy connect timeout');
117
118 }
119
106 ############################################################################### 120 ###############################################################################
107 121
108 sub getconn { 122 sub getconn {
109 my $peer = shift; 123 my $peer = shift;
110 my $s = IO::Socket::INET->new( 124 my $s = IO::Socket::INET->new(