comparison stream_ssl_realip.t @ 1168:8821e405b91e

Tests: handled SSL negotiation errors.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 20 Apr 2017 16:29:07 +0300
parents 8ef51dbb5d69
children cf14cfe9ec8c
comparison
equal deleted inserted replaced
1167:1e79a9613813 1168:8821e405b91e
129 my ($port, $proxy) = @_; 129 my ($port, $proxy) = @_;
130 130
131 my $s = stream(PeerPort => port($port)); 131 my $s = stream(PeerPort => port($port));
132 $s->write($proxy); 132 $s->write($proxy);
133 133
134 IO::Socket::SSL->start_SSL($s->{_socket}, 134 eval {
135 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(), 135 local $SIG{ALRM} = sub { die "timeout\n" };
136 SSL_error_trap => sub { die $_[1] } 136 local $SIG{PIPE} = sub { die "sigpipe\n" };
137 ); 137 alarm(2);
138 IO::Socket::SSL->start_SSL($s->{_socket},
139 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
140 SSL_error_trap => sub { die $_[1] }
141 );
142 alarm(0);
143 };
144 alarm(0);
145
146 if ($@) {
147 log_in("died: $@");
148 return undef;
149 }
138 150
139 return $s->read(); 151 return $s->read();
140 } 152 }
141 153
142 ############################################################################### 154 ###############################################################################