comparison mail_ssl.t @ 1872:7a27a4e4fdae

Tests: extended check for ALPN in mail_ssl.t. The 'alpn' test might fail if ALPN is not supported in Net::SSLeay. Patch by Maxim Dounin.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 23 May 2023 16:50:08 +0400
parents 7b7b64569f55
children c04134b0290b
comparison
equal deleted inserted replaced
1871:1ba5108b6c24 1872:7a27a4e4fdae
162 162
163 like($s->socket()->dump_peer_certificate(), qr/CN=inherits/, 'CN inner'); 163 like($s->socket()->dump_peer_certificate(), qr/CN=inherits/, 'CN inner');
164 164
165 # alpn 165 # alpn
166 166
167 SKIP: {
168 skip 'LibreSSL too old', 2
169 if $t->has_module('LibreSSL')
170 and not $t->has_feature('libressl:3.4.0');
171 skip 'OpenSSL too old', 2
172 if $t->has_module('OpenSSL')
173 and not $t->has_feature('openssl:1.1.0');
174 skip 'no ALPN support in IO::Socket::SSL', 2
175 unless $t->has_feature('socket_ssl_alpn');
176
167 $s = Test::Nginx::IMAP->new( 177 $s = Test::Nginx::IMAP->new(
168 PeerAddr => '127.0.0.1:' . port(8148), 178 PeerAddr => '127.0.0.1:' . port(8148),
169 SSL => 1, 179 SSL => 1,
170 SSL_alpn_protocols => [ 'imap' ] 180 SSL_alpn_protocols => [ 'imap' ]
171 ); 181 );
172 $s->ok('alpn'); 182 $s->ok('alpn');
173 183
174 SKIP: {
175 skip 'LibreSSL too old', 1
176 if $t->has_module('LibreSSL')
177 and not $t->has_feature('libressl:3.4.0');
178 skip 'OpenSSL too old', 1
179 if $t->has_module('OpenSSL')
180 and not $t->has_feature('openssl:1.1.0');
181
182 TODO: { 184 TODO: {
183 local $TODO = 'not yet' unless $t->has_version('1.21.4'); 185 local $TODO = 'not yet' unless $t->has_version('1.21.4');
184 local $TODO = 'no ALPN support in IO::Socket::SSL'
185 unless $t->has_feature('socket_ssl_alpn');
186 186
187 $s = Test::Nginx::IMAP->new( 187 $s = Test::Nginx::IMAP->new(
188 PeerAddr => '127.0.0.1:' . port(8148), 188 PeerAddr => '127.0.0.1:' . port(8148),
189 SSL => 1, 189 SSL => 1,
190 SSL_alpn_protocols => [ 'unknown' ] 190 SSL_alpn_protocols => [ 'unknown' ]