| 1 | # You may distribute under the terms of either the GNU General Public License | ||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||
| 3 | # | ||
| 4 | # (C) Paul Evans, 2010-2015 -- leonerd@leonerd.org.uk | ||
| 5 | |||
| 6 | package IO::Async::SSLStream; | ||
| 7 | |||
| 8 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use base qw( IO::Async::Stream ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | IO::Async::Stream->VERSION( '0.59' ); | |
| 12 | |||
| 13 | 1 | our $VERSION = '0.23'; | |
| 14 | 1 | $VERSION = eval $VERSION; | |
| 15 | |||
| 16 | 1 | ▶ | use IO::Async::SSL; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | C<IO::Async::SSLStream> - read and write buffers around an SSL connection | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This subclass of L<IO::Async::Stream> provides support for using an SSL | ||
| 25 | connection, as created by L<IO::Async::SSL>'s C<SSL_connect> or C<SSL_listen> | ||
| 26 | extension methods. After one of these methods has provided a socket handle, it | ||
| 27 | should be wrapped in an L<IO::Async::SSLStream> object to provide the usual | ||
| 28 | C<on_read> callback. | ||
| 29 | |||
| 30 | It provides no extra methods and consumes no extra configuration parameters; | ||
| 31 | treat it the same as a regular C<IO::Async::Stream> object. | ||
| 32 | |||
| 33 | See the main L<IO::Async::SSL> documentation for an example of its use. | ||
| 34 | |||
| 35 | =cut | ||
| 36 | |||
| 37 | sub _init | ||
| 38 | { | ||
| 39 | 0 | ▶ | my $self = shift; |
|
Subroutine
_init: not called CC=1 SCAR=6.9
| |||
| 40 | 0 | my ( $params ) = @_; | |
| 41 | |||
| 42 | 0 | $params->{reader} = \&IO::Async::SSL::sslread; | |
| 43 | 0 | $params->{writer} = \&IO::Async::SSL::sslwrite; | |
| 44 | |||
| 45 | 0 | $self->SUPER::_init( $params ); | |
| 46 | } | ||
| 47 | |||
| 48 | =head1 BUGS | ||
| 49 | |||
| 50 | =over 4 | ||
| 51 | |||
| 52 | =item * | ||
| 53 | |||
| 54 | Currently, this subclass does not completely handle the C<autoflush> configure | ||
| 55 | option. It is possible for the C<SSL_write(3ssl)> call to fail with C<EAGAIN> | ||
| 56 | and C<SSL_WANT_READ>, indicating that it wishes to read (perhaps to obtain | ||
| 57 | fresh keys from the server). In this case, the subclass will not correctly | ||
| 58 | poll for readability and retry the write operation. This bug does not occur | ||
| 59 | with regular C<write> with C<autoflush> turned off. | ||
| 60 | |||
| 61 | =back | ||
| 62 | |||
| 63 | =head1 AUTHOR | ||
| 64 | |||
| 65 | Paul Evans <leonerd@leonerd.org.uk> | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | 1 | 0x55AA; | |