line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::TLSify::ClientHandle; |
2
|
|
|
|
|
|
|
$POE::Component::TLSify::ClientHandle::VERSION = '0.08'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Client-side handle for TLSify |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
78
|
use strict; |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
322
|
|
6
|
11
|
|
|
11
|
|
63
|
use warnings; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
298
|
|
7
|
11
|
|
|
11
|
|
96
|
use POSIX qw[EAGAIN EWOULDBLOCK]; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
96
|
|
8
|
11
|
|
|
11
|
|
10477
|
use IO::Socket::SSL qw[$SSL_ERROR SSL_WANT_READ SSL_WANT_WRITE]; |
|
11
|
|
|
|
|
662488
|
|
|
11
|
|
|
|
|
113
|
|
9
|
|
|
|
|
|
|
|
10
|
11
|
|
|
11
|
|
7332
|
use parent 'POE::Component::TLSify::ServerHandle'; |
|
11
|
|
|
|
|
3361
|
|
|
11
|
|
|
|
|
72
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub TIEHANDLE { |
13
|
18
|
|
|
18
|
|
77
|
my ($class,$socket,$args,$connref) = @_; |
14
|
18
|
|
|
|
|
50
|
my $fileno = fileno($socket); |
15
|
|
|
|
|
|
|
|
16
|
18
|
|
|
|
|
75
|
my %SSL_ca_args = IO::Socket::SSL::default_ca(); |
17
|
|
|
|
|
|
|
|
18
|
18
|
50
|
66
|
|
|
1741
|
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
|
|
|
|
5
|
unless ( %SSL_ca_args ) { |
23
|
0
|
|
|
|
|
0
|
$SSL_ca_args{SSL_verify_mode} = IO::Socket::SSL::SSL_VERIFY_NONE(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
5
|
%$args = ( %SSL_ca_args, %$args ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
18
|
50
|
|
|
|
151
|
$socket = IO::Socket::SSL->start_SSL( |
30
|
|
|
|
|
|
|
$socket, |
31
|
|
|
|
|
|
|
SSL_startHandshake => 0, |
32
|
|
|
|
|
|
|
%$args, |
33
|
|
|
|
|
|
|
) or die IO::Socket::SSL->errstr; |
34
|
18
|
|
|
|
|
10506
|
$socket->connect_SSL; |
35
|
18
|
50
|
33
|
|
|
5501
|
if( $! != EAGAIN and $! != EWOULDBLOCK ) { |
36
|
0
|
|
|
|
|
0
|
die IO::Socket::SSL::errstr(); |
37
|
|
|
|
|
|
|
} |
38
|
18
|
|
|
|
|
133
|
my $self = bless { |
39
|
|
|
|
|
|
|
socket => $socket, |
40
|
|
|
|
|
|
|
started => 0, |
41
|
|
|
|
|
|
|
fileno => $fileno, |
42
|
|
|
|
|
|
|
method => 'connect_SSL', |
43
|
|
|
|
|
|
|
on_connect => $connref, |
44
|
|
|
|
|
|
|
}, $class; |
45
|
18
|
|
|
|
|
221
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
qq[I TLSify!]; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |