Merge tag 'upstream/1.057'
Upstream version 1.057
Salvatore Bonaccorso
7 years ago
|
0 |
1.057 2016/04/04
|
|
1 |
- removed warning with very old versions of LWP where
|
|
2 |
LWP::Protocol::https::VERSION was not defined yet.
|
|
3 |
Thanks to denis[AT]fateyev[DOT]com for reporting
|
|
4 |
|
|
5 |
1.056 2015/10/31
|
|
6 |
- fix another memory leak which happened on data connections only
|
|
7 |
- make sure that context reuse is done properly, see
|
|
8 |
https://github.com/noxxi/p5-net-sslglue/pull/3
|
|
9 |
|
0 | 10 |
1.055 2015/10/25
|
1 | 11 |
- fix memory leak in Net::SSLGlue::Socket, RT#107816.
|
2 | 12 |
Thanks to kasyap.mr[AT]gmail[DOT]com for reporting
|
41 | 41 |
"url" : "https://github.com/noxxi/p5-net-sslglue"
|
42 | 42 |
}
|
43 | 43 |
},
|
44 | |
"version" : "1.055"
|
|
44 |
"version" : "1.057"
|
45 | 45 |
}
|
20 | 20 |
IO::Socket::SSL: 1.19
|
21 | 21 |
resources:
|
22 | 22 |
repository: https://github.com/noxxi/p5-net-sslglue
|
23 | |
version: 1.055
|
|
23 |
version: 1.057
|
0 | 0 |
use strict;
|
1 | 1 |
use warnings;
|
2 | 2 |
package Net::SSLGlue::LWP;
|
3 | |
our $VERSION = 0.5;
|
|
3 |
our $VERSION = 0.501;
|
4 | 4 |
use LWP::UserAgent '5.822';
|
5 | 5 |
use IO::Socket::SSL 1.19;
|
6 | 6 |
use URI;
|
|
10 | 10 |
my $use_existent;
|
11 | 11 |
BEGIN {
|
12 | 12 |
require LWP::Protocol::https;
|
13 | |
$use_existent = $LWP::Protocol::https::VERSION >= 6.06
|
|
13 |
$use_existent = $LWP::Protocol::https::VERSION
|
|
14 |
&& $LWP::Protocol::https::VERSION >= 6.06
|
14 | 15 |
&& $LWP::UserAgent::VERSION >= 6.06;
|
15 | 16 |
if ($use_existent) {
|
16 | 17 |
my $oc = $Net::HTTPS::SSL_SOCKET_CLASS ||
|
41 | 41 |
tie *{$self}, "Net::SSLGlue::Socket::HANDLE", $self;
|
42 | 42 |
|
43 | 43 |
return $self;
|
|
44 |
}
|
|
45 |
|
|
46 |
sub DESTROY {
|
|
47 |
my $self = shift;
|
|
48 |
%{*$self} = ();
|
44 | 49 |
}
|
45 | 50 |
|
46 | 51 |
for my $sub (qw(
|
|
80 | 85 |
};
|
81 | 86 |
|
82 | 87 |
sub start_SSL {
|
83 | |
my $self = shift;
|
|
88 |
my ($self,%args) = @_;
|
84 | 89 |
croak("start_SSL called on SSL socket") if ${*$self}{ssl};
|
85 | |
IO::Socket::SSL->start_SSL(${*$self}{sock},%{${*$self}{sslargs}},@_)
|
86 | |
or return;
|
|
90 |
|
|
91 |
%args = (%{${*$self}{sslargs}},%args);
|
|
92 |
if (my $ctx = $args{SSL_reuse_ctx}) {
|
|
93 |
# take the context from the attached socket
|
|
94 |
$args{SSL_reuse_ctx} = ${*$ctx}{sock}
|
|
95 |
if $ctx->isa('Net::SSLGlue::Socket');
|
|
96 |
}
|
|
97 |
IO::Socket::SSL->start_SSL(${*$self}{sock},%args) or return;
|
87 | 98 |
${*$self}{ssl} = 1;
|
88 | 99 |
return $self;
|
89 | 100 |
}
|
|
164 | 175 |
$plain->stop_SSL
|
165 | 176 |
|
166 | 177 |
|
167 | |
=head1 DESCRIPTIONA
|
|
178 |
=head1 DESCRIPTION
|
168 | 179 |
|
169 | 180 |
First, it is recommended to use L<IO::Socket::SSL> directly instead of this
|
170 | 181 |
module, since this kind of functionality is available in IO::Socket::SSL since
|
0 | 0 |
package Net::SSLGlue;
|
1 | |
our $VERSION = '1.055';
|
|
1 |
our $VERSION = '1.057';
|
2 | 2 |
|
3 | 3 |
=head1 NAME
|
4 | 4 |
|
17 | 17 |
use IO::Socket::SSL;
|
18 | 18 |
use File::Temp;
|
19 | 19 |
|
20 | |
# first try to connect w/o ftp
|
21 | |
# plain
|
22 | |
diag( "connect inet to $server:21" );
|
23 | |
IO::Socket::INET->new( "$server:21" ) or do {
|
24 | |
plan skip_all => "$server:21 not reachable";
|
25 | |
};
|
|
20 |
# check if we can connect and log in at all (plain)
|
|
21 |
diag( "connect ftp w/o ssl to $server" );
|
|
22 |
my $ftp;
|
|
23 |
if ( $ftp = Net::FTP->new($server, Debug => $debug)
|
|
24 |
and $ftp->login("anonymous",'net-sslglue-ftp@test.perl')) {
|
|
25 |
diag( "connect ftp w/o ssl to $server works" );
|
|
26 |
} else {
|
|
27 |
plan skip_all => "no connect/login w/o ssl possible";
|
|
28 |
}
|
|
29 |
|
26 | 30 |
|
27 | 31 |
# ssl to the right host
|
28 | 32 |
diag( "connect inet to $server:990" );
|
|
50 | 54 |
|
51 | 55 |
# first direct SSL
|
52 | 56 |
diag( "connect ftp over ssl to $server" );
|
53 | |
my $ftp = Net::FTP->new($server,
|
|
57 |
$ftp = Net::FTP->new($server,
|
54 | 58 |
SSL => 1,
|
55 | 59 |
%sslargs,
|
56 | 60 |
Debug => $debug,
|