annotate ssl_password_file.t @ 430:a82b02635614

Tests: skip ssl tests with ancient IO::Socket::SSL. The IO::Socket::SSL::SSL_VERIFY_NONE was introduced in IO::Socket:SSL 1.31 (2009.09.25), and it seems to be too new for some Linux distros (notably, CentOS 5).
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 08 Jul 2014 16:34:31 +0400
parents 1ac74b568503
children 05c46688b54b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
420
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3 # (C) Sergey Kandaurov
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4 # (C) Nginx, Inc.
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
5
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
6 # Tests for ssl_password_file directive.
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
7
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
8 ###############################################################################
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
9
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
10 use warnings;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
11 use strict;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
12
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
13 use Test::More;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
14
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
15 use POSIX qw/ mkfifo /;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
16 use Socket qw/ $CRLF /;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
17
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
18 BEGIN { use FindBin; chdir($FindBin::Bin); }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
19
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
20 use lib 'lib';
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
21 use Test::Nginx;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
22
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
23 ###############################################################################
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
24
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
25 select STDERR; $| = 1;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
26 select STDOUT; $| = 1;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
27
430
a82b02635614 Tests: skip ssl tests with ancient IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents: 423
diff changeset
28 eval { require IO::Socket::SSL; IO::Socket::SSL::SSL_VERIFY_NONE(); };
420
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
29 plan(skip_all => 'IO::Socket::SSL not installed') if $@;
430
a82b02635614 Tests: skip ssl tests with ancient IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents: 423
diff changeset
30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
a82b02635614 Tests: skip ssl tests with ancient IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents: 423
diff changeset
31 plan(skip_all => 'IO::Socket::SSL too old') if $@;
a82b02635614 Tests: skip ssl tests with ancient IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents: 423
diff changeset
32
420
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
33 plan(skip_all => 'win32') if $^O eq 'MSWin32';
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
34
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
35 my $t = Test::Nginx->new()->has(qw/http http_ssl/)->has_daemon('openssl');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
36
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
37 plan(skip_all => 'no ssl_password_file') unless $t->has_version('1.7.2');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
38
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
39 $t->plan(3)->write_file_expand('nginx.conf', <<'EOF');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
40
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
41 %%TEST_GLOBALS%%
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
42
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
43 daemon off;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
44
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
45 events {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
46 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
47
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
48 http {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
49 %%TEST_GLOBALS_HTTP%%
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
50
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
51 ssl_certificate_key localhost.key;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
52 ssl_certificate localhost.crt;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
53
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54 # inherited by server "inherits"
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
55 ssl_password_file password_http;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
57 server {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
58 listen 127.0.0.1:8443 ssl;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
59 listen 127.0.0.1:8080;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
60 server_name localhost;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
61
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
62 ssl_password_file password;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
63
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
64 location / {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
65 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
66 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
67
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
68 server {
421
e8db4355fe0b Tests: fixed building the server_names_hash.
Sergey Kandaurov <pluknet@nginx.com>
parents: 420
diff changeset
69 server_name two_entries;
420
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
70
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
71 ssl_password_file password_many;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
72 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
73
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
74 server {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
75 server_name file_is_fifo;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
76
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
77 ssl_password_file password_fifo;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
78 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
79
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
80 server {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
81 server_name inherits;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
82
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
83 ssl_certificate_key inherits.key;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
84 ssl_certificate inherits.crt;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
85 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
86 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
87
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
88 EOF
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
89
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
90 $t->write_file('openssl.conf', <<EOF);
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
91 [ req ]
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
92 default_bits = 2048
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
93 encrypt_key = no
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
94 distinguished_name = req_distinguished_name
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
95 [ req_distinguished_name ]
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
96 EOF
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
97
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
98 my $d = $t->testdir();
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
99 mkfifo("$d/password_fifo", 0700);
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
100
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
101 foreach my $name ('localhost', 'inherits') {
423
1ac74b568503 Tests: unbreak ssl_password_file.t with upcoming OpenSSL 1.0.2.
Maxim Dounin <mdounin@mdounin.ru>
parents: 421
diff changeset
102 system("openssl genrsa -out $d/$name.key -passout pass:$name 2048 "
420
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
103 . ">>$d/openssl.out 2>&1") == 0
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
104 or die "Can't create private key: $!\n";
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
105 system('openssl req -x509 -new '
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
106 . "-config '$d/openssl.conf' -subj '/CN=$name/' "
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
107 . "-out '$d/$name.crt' "
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
108 . "-key '$d/$name.key' -passin pass:$name"
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
109 . ">>$d/openssl.out 2>&1") == 0
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
110 or die "Can't create certificate for $name: $!\n";
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
111 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
112
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
113 $t->write_file('password', 'localhost');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
114 $t->write_file('password_many', "wrong$CRLF" . "localhost$CRLF");
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
115 $t->write_file('password_http', 'inherits');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
116
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
117 fork() || exec("echo localhost > $d/password_fifo");
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
118
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
119 # do not mangle with try_run()
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
120 # we need to distinguish ssl_password_file support vs its brokenness
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
121
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
122 eval {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
123 open OLDERR, ">&", \*STDERR; close STDERR;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
124 $t->run();
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
125 open STDERR, ">&", \*OLDERR;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
126 };
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
127
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
128 ###############################################################################
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
129
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
130 is($@, '', 'ssl_password_file works');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
131
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
132 # simple tests to ensure that nothing broke with ssl_password_file directive
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
133
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
134 like(http_get('/password'), qr/200 OK/, 'http');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
135 like(http_get('/password', socket => get_ssl_socket()), qr/200 OK/, 'https');
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
136
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
137 ###############################################################################
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
138
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
139 sub get_ssl_socket {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
140 my $s;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
141
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
142 eval {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
143 local $SIG{ALRM} = sub { die "timeout\n" };
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
144 local $SIG{PIPE} = sub { die "sigpipe\n" };
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
145 alarm(2);
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
146 $s = IO::Socket::SSL->new(
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
147 Proto => 'tcp',
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
148 PeerAddr => '127.0.0.1:8443',
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
149 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
150 SSL_error_trap => sub { die $_[1] }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
151 );
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
152 alarm(0);
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
153 };
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
154 alarm(0);
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
155
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
156 if ($@) {
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
157 log_in("died: $@");
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
158 return undef;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
159 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
160
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
161 return $s;
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
162 }
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
163
a37ec4447597 Tests: ssl_password_file tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
164 ###############################################################################