comparison ssl_client_escaped_cert.t @ 1866:a797d7428fa5

Tests: simplified http SSL tests with IO::Socket::SSL. The http SSL tests which previously used IO::Socket::SSL were converted to use improved IO::Socket::SSL infrastructure in Test::Nginx.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 18 May 2023 18:07:19 +0300
parents cdcd75657e52
children
comparison
equal deleted inserted replaced
1865:0e1865aa9b33 1866:a797d7428fa5
89 89
90 ############################################################################### 90 ###############################################################################
91 91
92 sub cert { 92 sub cert {
93 my ($uri) = @_; 93 my ($uri) = @_;
94 my $s; 94 return http_get(
95 95 $uri,
96 eval { 96 SSL => 1,
97 local $SIG{ALRM} = sub { die "timeout\n" }; 97 SSL_cert_file => "$d/localhost.crt",
98 local $SIG{PIPE} = sub { die "sigpipe\n" }; 98 SSL_key_file => "$d/localhost.key"
99 alarm(8); 99 );
100 $s = IO::Socket::SSL->new(
101 Proto => 'tcp',
102 PeerAddr => '127.0.0.1',
103 PeerPort => port(8443),
104 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
105 SSL_cert_file => "$d/localhost.crt",
106 SSL_key_file => "$d/localhost.key",
107 SSL_error_trap => sub { die $_[1] },
108 );
109 alarm(0);
110 };
111 alarm(0);
112
113 if ($@) {
114 log_in("died: $@");
115 return undef;
116 }
117
118 http_get($uri, socket => $s);
119 } 100 }
120 101
121 ############################################################################### 102 ###############################################################################