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