comparison stream_ssl_preread_alpn.t @ 1864:46351d990aee

Tests: simplified stream SSL tests with IO::Socket::SSL. The stream SSL tests which previously used IO::Socket::SSL were converted to use infrastructure in Test::Nginx::Stream where appropriate.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 18 May 2023 18:07:15 +0300
parents cdcd75657e52
children
comparison
equal deleted inserted replaced
1863:dbb7561a9441 1864:46351d990aee
112 112
113 ############################################################################### 113 ###############################################################################
114 114
115 sub get_ssl { 115 sub get_ssl {
116 my ($port, @alpn) = @_; 116 my ($port, @alpn) = @_;
117 my $s = stream('127.0.0.1:' . port($port));
118 117
119 eval { 118 my $s = stream(
120 local $SIG{ALRM} = sub { die "timeout\n" }; 119 PeerAddr => '127.0.0.1:' . port($port),
121 local $SIG{PIPE} = sub { die "sigpipe\n" }; 120 SSL => 1,
122 alarm(8); 121 SSL_alpn_protocols => [ @alpn ]
123 IO::Socket::SSL->start_SSL($s->{_socket}, 122 );
124 SSL_alpn_protocols => [ @alpn ],
125 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
126 SSL_error_trap => sub { die $_[1] }
127 );
128 alarm(0);
129 };
130 alarm(0);
131
132 if ($@) {
133 log_in("died: $@");
134 return undef;
135 }
136 123
137 return $s->read(); 124 return $s->read();
138 } 125 }
139 126
140 ############################################################################### 127 ###############################################################################