Mercurial > hg > nginx-tests
diff stream_ssl_verify_client.t @ 1621:fd440d324700
Tests: simplified get_ssl_socket() functions that use Net::SSLeay.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 24 Nov 2020 00:43:56 +0000 |
parents | f3ba4c74de31 |
children | 818e6d8c43b5 |
line wrap: on
line diff
--- a/stream_ssl_verify_client.t +++ b/stream_ssl_verify_client.t @@ -13,8 +13,6 @@ use strict; use Test::More; -use Socket; - BEGIN { use FindBin; chdir($FindBin::Bin); } use lib 'lib'; @@ -142,12 +140,7 @@ is($t->read_file('status.log'), "500\n20 sub get { my ($port, $cert) = @_; - my $dest_ip = inet_aton('127.0.0.1'); - my $dest_serv_params = sockaddr_in(port($port), $dest_ip); - - socket(my $s, &AF_INET, &SOCK_STREAM, 0) or die "socket: $!"; - connect($s, $dest_serv_params) or die "connect: $!"; - + my $s = IO::Socket::INET->new('127.0.0.1:' . port($port)); my $ctx = Net::SSLeay::CTX_new() or die("Failed to create SSL_CTX $!"); Net::SSLeay::set_cert_and_key($ctx, "$d/$cert.crt", "$d/$cert.key") or die if $cert;