… | |
… | |
1371 | sub starttls { |
1371 | sub starttls { |
1372 | my ($self, $ssl, $ctx) = @_; |
1372 | my ($self, $ssl, $ctx) = @_; |
1373 | |
1373 | |
1374 | require Net::SSLeay; |
1374 | require Net::SSLeay; |
1375 | |
1375 | |
1376 | Carp::croak "it is an error to call starttls more than once on an Anyevent::Handle object" |
1376 | Carp::croak "it is an error to call starttls more than once on an AnyEvent::Handle object" |
1377 | if $self->{tls}; |
1377 | if $self->{tls}; |
1378 | |
1378 | |
1379 | if ($ssl eq "accept") { |
1379 | if ($ssl eq "accept") { |
1380 | $ssl = Net::SSLeay::new ($ctx || TLS_CTX ()); |
1380 | $ssl = Net::SSLeay::new ($ctx || TLS_CTX ()); |
1381 | Net::SSLeay::set_accept_state ($ssl); |
1381 | Net::SSLeay::set_accept_state ($ssl); |