Codebase list libnet-sslglue-perl / 9ffa9c4
Imported Upstream version 1.055 gregor herrmann 8 years ago
5 changed file(s) with 43 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
0 1.055 2015/10/25
1 - fix memory leak in Net::SSLGlue::Socket, RT#107816.
2 Thanks to kasyap.mr[AT]gmail[DOT]com for reporting
3
04 1.054 2015/04/28
15 - if a version of libnet is detected which already supports TLS (i.e.
26 libnet 3.0+) warn and use this instead.
4141 "url" : "https://github.com/noxxi/p5-net-sslglue"
4242 }
4343 },
44 "version" : "1.054"
44 "version" : "1.055"
4545 }
2020 IO::Socket::SSL: 1.19
2121 resources:
2222 repository: https://github.com/noxxi/p5-net-sslglue
23 version: 1.054
23 version: 1.055
00
11 package Net::SSLGlue::Socket;
2 our $VERSION = 1.001;
2 our $VERSION = 1.002;
33
44 use strict;
55 use warnings;
3434 or return;
3535
3636 my $self = gensym();
37 *$self = *$sock; # clone handle
3837 bless $self,$class;
3938 ${*$self}{sock} = $sock;
4039 ${*$self}{ssl} = $ssl;
4140 ${*$self}{sslargs} = \%sslargs;
41 tie *{$self}, "Net::SSLGlue::Socket::HANDLE", $self;
4242
4343 return $self;
4444 }
113113 return ${*$self}{ssl} && ${*$self}{sock};
114114 }
115115
116 package Net::SSLGlue::Socket::HANDLE;
117 use strict;
118 use Errno 'EBADF';
119 use Scalar::Util 'weaken';
120
121 sub TIEHANDLE {
122 my ($class, $handle) = @_;
123 weaken($handle);
124 bless \$handle, $class;
125 }
126
127 sub READ { ${shift()}->sysread(@_) }
128 sub READLINE { ${shift()}->readline(@_) }
129 sub GETC { ${shift()}->getc(@_) }
130 sub PRINT { ${shift()}->print(@_) }
131 sub PRINTF { ${shift()}->printf(@_) }
132 sub WRITE { ${shift()}->syswrite(@_) }
133 sub FILENO { ${shift()}->fileno(@_) }
134 sub TELL { $! = EBADF; return -1 }
135 sub BINMODE { return 0 } # not perfect, but better than not implementing the method
136 sub CLOSE { #<---- Do not change this function!
137 my $ssl = ${$_[0]};
138 local @_;
139 $ssl->close();
140 }
141
142
116143 1;
117144
118145 =head1 NAME
137164 $plain->stop_SSL
138165
139166
140 =head1 DESCRIPTION
167 =head1 DESCRIPTIONA
168
169 First, it is recommended to use L<IO::Socket::SSL> directly instead of this
170 module, since this kind of functionality is available in IO::Socket::SSL since
171 version 1.994.
141172
142173 L<Net::SSLGlue::Socket> implements a socket which can be either plain or SSL.
143174 If IO::Socket::IP or IO::Socket::INET6 are installed it will also transparently
197228
198229 =head1 COPYRIGHT
199230
200 This module is copyright (c) 2013, Steffen Ullrich.
231 This module is copyright (c) 2013..2015, Steffen Ullrich.
201232 All Rights Reserved.
202233 This module is free software. It may be used, redistributed and/or modified
203234 under the same terms as Perl itself.
00 package Net::SSLGlue;
1 our $VERSION = '1.054';
1 our $VERSION = '1.055';
22
33 =head1 NAME
44
3535 =head1 COPYRIGHT
3636
3737 This module and the modules in the Net::SSLGlue Hierarchy distributed together
38 with this module are copyright (c) 2008-2013, Steffen Ullrich.
38 with this module are copyright (c) 2008-2015, Steffen Ullrich.
3939 All Rights Reserved.
4040 These modules are free software. They may be used, redistributed and/or modified
4141 under the same terms as Perl itself.