… | |
… | |
1519 | |
1519 | |
1520 | Instead of starting TLS negotiation immediately when the AnyEvent::Handle |
1520 | Instead of starting TLS negotiation immediately when the AnyEvent::Handle |
1521 | object is created, you can also do that at a later time by calling |
1521 | object is created, you can also do that at a later time by calling |
1522 | C<starttls>. |
1522 | C<starttls>. |
1523 | |
1523 | |
|
|
1524 | Starting TLS is currently an asynchronous operation - when you push some |
|
|
1525 | write data and then call C<< ->starttls >> then TLS negotiation will start |
|
|
1526 | immediately, after which the queued write data is then sent. |
|
|
1527 | |
1524 | The first argument is the same as the C<tls> constructor argument (either |
1528 | The first argument is the same as the C<tls> constructor argument (either |
1525 | C<"connect">, C<"accept"> or an existing Net::SSLeay object). |
1529 | C<"connect">, C<"accept"> or an existing Net::SSLeay object). |
1526 | |
1530 | |
1527 | The second argument is the optional C<AnyEvent::TLS> object that is used |
1531 | The second argument is the optional C<AnyEvent::TLS> object that is used |
1528 | when AnyEvent::Handle has to create its own TLS connection object, or |
1532 | when AnyEvent::Handle has to create its own TLS connection object, or |
… | |
… | |
1552 | $ERROR_SYSCALL = Net::SSLeay::ERROR_SYSCALL (); |
1556 | $ERROR_SYSCALL = Net::SSLeay::ERROR_SYSCALL (); |
1553 | $ERROR_WANT_READ = Net::SSLeay::ERROR_WANT_READ (); |
1557 | $ERROR_WANT_READ = Net::SSLeay::ERROR_WANT_READ (); |
1554 | |
1558 | |
1555 | $ctx ||= $self->{tls_ctx}; |
1559 | $ctx ||= $self->{tls_ctx}; |
1556 | |
1560 | |
|
|
1561 | local $Carp::CarpLevel = 1; # skip ourselves when creating a new context or session |
|
|
1562 | |
1557 | if ("HASH" eq ref $ctx) { |
1563 | if ("HASH" eq ref $ctx) { |
1558 | require AnyEvent::TLS; |
1564 | require AnyEvent::TLS; |
1559 | |
|
|
1560 | local $Carp::CarpLevel = 1; # skip ourselves when creating a new context |
|
|
1561 | |
1565 | |
1562 | if ($ctx->{cache}) { |
1566 | if ($ctx->{cache}) { |
1563 | my $key = $ctx+0; |
1567 | my $key = $ctx+0; |
1564 | $ctx = $TLS_CACHE{$key} ||= new AnyEvent::TLS %$ctx; |
1568 | $ctx = $TLS_CACHE{$key} ||= new AnyEvent::TLS %$ctx; |
1565 | } else { |
1569 | } else { |