annotate stream_upstream_zone_ssl.t @ 929:15abee29016e

Tests: proxy_cache_bypass and ticket #827 tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 13 May 2016 19:50:13 +0300
parents ca74dc9abd1a
children e9064d691790
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
560
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3 # (C) Sergey Kandaurov
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4 # (C) Nginx, Inc.
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
5
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
6 # Stream tests for upstream zone with ssl backend.
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
7
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
8 ###############################################################################
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
9
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
10 use warnings;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
11 use strict;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
12
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
13 use Test::More;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
14
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
15 BEGIN { use FindBin; chdir($FindBin::Bin); }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
16
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
17 use lib 'lib';
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
18 use Test::Nginx;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
19
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
20 ###############################################################################
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
21
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
22 select STDERR; $| = 1;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
23 select STDOUT; $| = 1;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
24
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
25 my $t = Test::Nginx->new()->has(qw/stream stream_ssl http http_ssl/)
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
26 ->has(qw/stream_upstream_zone/)->has_daemon('openssl')->plan(8);
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
27
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
28 $t->write_file_expand('nginx.conf', <<'EOF');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
29
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
30 %%TEST_GLOBALS%%
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
31
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
32 daemon off;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
33
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
34 events {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
35 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
36
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
37 stream {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
38 proxy_ssl on;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
39 proxy_ssl_session_reuse on;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
40
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
41 upstream u {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
42 zone u 32k;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
43 server 127.0.0.1:8087;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
44 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
45
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
46 upstream u2 {
563
ca74dc9abd1a Tests: adjusted stream tests with upstream zone.
Sergey Kandaurov <pluknet@nginx.com>
parents: 560
diff changeset
47 zone u2 32k;
560
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
48 server 127.0.0.1:8087 backup;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
49 server 127.0.0.1:8088 down;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
50 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
51
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
52 server {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
53 listen 127.0.0.1:8080;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54 proxy_pass u;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
55 proxy_ssl_session_reuse off;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
57
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
58 server {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
59 listen 127.0.0.1:8081;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
60 proxy_pass u;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
61 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
62
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
63 server {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
64 listen 127.0.0.1:8082;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
65 proxy_pass u2;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
66 proxy_ssl_session_reuse off;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
67 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
68
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
69 server {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
70 listen 127.0.0.1:8083;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
71 proxy_pass u2;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
72 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
73 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
74
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
75 http {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
76 %%TEST_GLOBALS_HTTP%%
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
77
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
78 server {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
79 listen 127.0.0.1:8087 ssl;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
80
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
81 ssl_certificate_key localhost.key;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
82 ssl_certificate localhost.crt;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
83 ssl_session_cache builtin;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
84
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
85 location / {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
86 add_header X-Session $ssl_session_reused;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
87 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
88 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
89 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
90
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
91 EOF
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
92
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
93 $t->write_file('openssl.conf', <<EOF);
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
94 [ req ]
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
95 default_bits = 2048
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
96 encrypt_key = no
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
97 distinguished_name = req_distinguished_name
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
98 [ req_distinguished_name ]
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
99 EOF
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
100
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
101 $t->write_file('index.html', '');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
102
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
103 my $d = $t->testdir();
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
104
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
105 foreach my $name ('localhost') {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
106 system('openssl req -x509 -new '
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
107 . "-config '$d/openssl.conf' -subj '/CN=$name/' "
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
108 . "-out '$d/$name.crt' -keyout '$d/$name.key' "
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
109 . ">>$d/openssl.out 2>&1") == 0
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
110 or die "Can't create certificate for $name: $!\n";
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
111 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
112
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
113 $t->run();
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
114
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
115 ###############################################################################
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
116
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
117 like(http_get('/', socket => getconn('127.0.0.1:8080')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
118 qr/200 OK.*X-Session: \./s, 'ssl');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
119 like(http_get('/', socket => getconn('127.0.0.1:8081')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
120 qr/200 OK.*X-Session: \./s, 'ssl 2');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
121
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
122 like(http_get('/', socket => getconn('127.0.0.1:8080')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
123 qr/200 OK.*X-Session: \./s, 'ssl reuse session');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
124 like(http_get('/', socket => getconn('127.0.0.1:8081')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
125 qr/200 OK.*X-Session: r/s, 'ssl reuse session 2');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
126
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
127 like(http_get('/', socket => getconn('127.0.0.1:8082')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
128 qr/200 OK.*X-Session: \./s, 'ssl backup');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
129 like(http_get('/', socket => getconn('127.0.0.1:8083')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
130 qr/200 OK.*X-Session: \./s, 'ssl backup 2');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
131
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
132 like(http_get('/', socket => getconn('127.0.0.1:8082')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
133 qr/200 OK.*X-Session: \./s, 'ssl reuse session backup');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
134 like(http_get('/', socket => getconn('127.0.0.1:8083')),
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
135 qr/200 OK.*X-Session: r/s, 'ssl reuse session backup 2');
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
136
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
137 ###############################################################################
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
138
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
139 sub getconn {
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
140 my $peer = shift;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
141 my $s = IO::Socket::INET->new(
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
142 Proto => 'tcp',
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
143 PeerAddr => $peer || '127.0.0.1:8080'
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
144 )
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
145 or die "Can't connect to nginx: $!\n";
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
146
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
147 return $s;
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
148 }
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
149
f3434de79a7f Tests: upstream zone tests with ssl backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
150 ###############################################################################