line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::TLSify::ClientHandle; |
2
|
|
|
|
|
|
|
$POE::Component::TLSify::ClientHandle::VERSION = '0.06'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Client-side handle for TLSify |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
63
|
use strict; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
286
|
|
6
|
11
|
|
|
11
|
|
49
|
use warnings; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
248
|
|
7
|
11
|
|
|
11
|
|
49
|
use POSIX qw[EAGAIN EWOULDBLOCK]; |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
81
|
|
8
|
11
|
|
|
11
|
|
8546
|
use IO::Socket::SSL qw[$SSL_ERROR SSL_WANT_READ SSL_WANT_WRITE]; |
|
11
|
|
|
|
|
546718
|
|
|
11
|
|
|
|
|
85
|
|
9
|
|
|
|
|
|
|
|
10
|
11
|
|
|
11
|
|
6153
|
use parent 'POE::Component::TLSify::ServerHandle'; |
|
11
|
|
|
|
|
2815
|
|
|
11
|
|
|
|
|
60
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub TIEHANDLE { |
13
|
18
|
|
|
18
|
|
50
|
my ($class,$socket,$args,$connref) = @_; |
14
|
18
|
|
|
|
|
43
|
my $fileno = fileno($socket); |
15
|
|
|
|
|
|
|
|
16
|
18
|
|
|
|
|
57
|
my %SSL_ca_args = IO::Socket::SSL::default_ca(); |
17
|
|
|
|
|
|
|
|
18
|
18
|
50
|
66
|
|
|
1408
|
if ( !defined $args->{SSL_verify_mode} |
|
|
|
33
|
|
|
|
|
19
|
|
|
|
|
|
|
and !defined $args->{SSL_ca_file} |
20
|
|
|
|
|
|
|
and !defined $args->{SSL_ca_path} ) { |
21
|
|
|
|
|
|
|
|
22
|
1
|
50
|
|
|
|
4
|
unless ( %SSL_ca_args ) { |
23
|
0
|
|
|
|
|
0
|
$SSL_ca_args{SSL_verify_mode} = IO::Socket::SSL::SSL_VERIFY_NONE(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
4
|
%$args = ( %SSL_ca_args, %$args ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
18
|
50
|
|
|
|
154
|
$socket = IO::Socket::SSL->start_SSL( |
30
|
|
|
|
|
|
|
$socket, |
31
|
|
|
|
|
|
|
SSL_startHandshake => 0, |
32
|
|
|
|
|
|
|
%$args, |
33
|
|
|
|
|
|
|
) or die IO::Socket::SSL->errstr; |
34
|
18
|
|
|
|
|
8573
|
$socket->connect_SSL; |
35
|
18
|
50
|
33
|
|
|
4612
|
if( $! != EAGAIN and $! != EWOULDBLOCK ) { |
36
|
0
|
|
|
|
|
0
|
die IO::Socket::SSL::errstr(); |
37
|
|
|
|
|
|
|
} |
38
|
18
|
|
|
|
|
108
|
my $self = bless { |
39
|
|
|
|
|
|
|
socket => $socket, |
40
|
|
|
|
|
|
|
started => 0, |
41
|
|
|
|
|
|
|
fileno => $fileno, |
42
|
|
|
|
|
|
|
method => 'connect_SSL', |
43
|
|
|
|
|
|
|
on_connect => $connref, |
44
|
|
|
|
|
|
|
}, $class; |
45
|
18
|
|
|
|
|
189
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
qq[I TLSify!]; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |