Package list libpoe-component-sslify-perl / aad5ab0
applied patches from ASCENT for nonblocking and prepare for new CPAN release Apocalypse 11 years ago
16 changed file(s) with 379 addition(s) and 533 deletion(s). Raw diff Collapse all Expand all
0 # Build.PL
1 use strict; use warnings;
2 use Module::Build;
3
4 my $build = Module::Build->new(
5 # look up Module::Build::API for the info!
6 'dynamic_config' => 0,
7 'module_name' => 'POE::Component::SSLify',
8 'license' => 'perl',
9
10 'dist_abstract' => 'SSL in the world of POE made easy',
11
12 'create_packlist' => 1,
13 'create_makefile_pl' => 'traditional',
14 'create_readme' => 1,
15
16 'test_files' => 't/*.t',
17
18 'add_to_cleanup' => [ 'META.yml', 'Makefile.PL', 'README', 'Manifest' ], # automatically generated
19
20 'requires' => {
21 # Networking
22 'Net::SSLeay' => '1.30',
23
24 # minimum perl version
25 'perl' => '5.006',
26 },
27 );
28
29 # all done!
30 $build->create_build_script;
0 # Build.PL
1 use strict; use warnings;
2 use Module::Build;
3
4 my $build = Module::Build->new(
5 # look up Module::Build::API for the info!
6 'dynamic_config' => 0,
7 'module_name' => 'POE::Component::SSLify',
8 'license' => 'perl',
9
10 'dist_abstract' => 'SSL in the world of POE made easy',
11
12 'create_packlist' => 1,
13 'create_makefile_pl' => 'traditional',
14 'create_readme' => 1,
15 'create_license' => 1,
16 'sign' => 0,
17
18 'test_files' => 't/*.t',
19
20 'add_to_cleanup' => [ 'META.yml', 'Makefile.PL', 'README', 'Manifest', 'LICENSE' ], # automatically generated
21
22 'requires' => {
23 # Networking
24 'Net::SSLeay' => '1.36',
25
26 # minimum perl version
27 'perl' => '5.006',
28 },
29
30 'build_requires' => {
31 # For the t/simple.t test
32 'POE' => 0,
33 'POE::Component::Client::TCP' => 0,
34 'POE::Component::Server::TCP' => 0,
35 },
36
37 # include the standard stuff in META.yml
38 'meta_merge' => {
39 'resources' => {
40 'license' => 'http://dev.perl.org/licenses/',
41 'homepage' => 'http://search.cpan.org/dist/POE-Component-SSLify',
42 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify',
43 'repository' => 'http://github.com/apocalypse/perl-poe-sslify',
44 },
45 },
46 );
47
48 # all done!
49 $build->create_build_script;
00 Revision history for Perl extension POE::Component::SSLify.
1
2 * 0.16
3
4 Updated the nonblocking code to be production-ready, thanks ASCENT!
5 Removed the NONBLOCKING() sub, this module is now always nonblocking.
6 Added more tests, thanks ASCENT!
7 Added "mylib/example.crt" and "mylib/example.key" for testing, thanks ASCENT!
8 Misc kwalitee and POD fixes.
9 Bumped Net::SSLeay prereq to 1.36 so we have the latest SSL stuff to ensure sanity :)
110
211 * 0.15
312
+0
-377
LICENSE less more
0 This software is copyright (c) 2009 by Apocalypse.
1
2 This is free software; you can redistribute it and/or modify it under
3 the same terms as perl itself.
4
5 Terms of Perl itself
6
7 a) the GNU General Public License as published by the Free
8 Software Foundation; either version 1, or (at your option) any
9 later version, or
10 b) the "Artistic License"
11
12 --- The GNU General Public License, Version 1, February 1989 ---
13
14 This software is Copyright (c) 2008 by the POE authors.
15
16 This is free software, licensed under:
17
18 The GNU General Public License, Version 1, February 1989
19
20 GNU GENERAL PUBLIC LICENSE
21 Version 1, February 1989
22
23 Copyright (C) 1989 Free Software Foundation, Inc.
24 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
25 Everyone is permitted to copy and distribute verbatim copies
26 of this license document, but changing it is not allowed.
27
28 Preamble
29
30 The license agreements of most software companies try to keep users
31 at the mercy of those companies. By contrast, our General Public
32 License is intended to guarantee your freedom to share and change free
33 software--to make sure the software is free for all its users. The
34 General Public License applies to the Free Software Foundation's
35 software and to any other program whose authors commit to using it.
36 You can use it for your programs, too.
37
38 When we speak of free software, we are referring to freedom, not
39 price. Specifically, the General Public License is designed to make
40 sure that you have the freedom to give away or sell copies of free
41 software, that you receive source code or can get it if you want it,
42 that you can change the software or use pieces of it in new free
43 programs; and that you know you can do these things.
44
45 To protect your rights, we need to make restrictions that forbid
46 anyone to deny you these rights or to ask you to surrender the rights.
47 These restrictions translate to certain responsibilities for you if you
48 distribute copies of the software, or if you modify it.
49
50 For example, if you distribute copies of a such a program, whether
51 gratis or for a fee, you must give the recipients all the rights that
52 you have. You must make sure that they, too, receive or can get the
53 source code. And you must tell them their rights.
54
55 We protect your rights with two steps: (1) copyright the software, and
56 (2) offer you this license which gives you legal permission to copy,
57 distribute and/or modify the software.
58
59 Also, for each author's protection and ours, we want to make certain
60 that everyone understands that there is no warranty for this free
61 software. If the software is modified by someone else and passed on, we
62 want its recipients to know that what they have is not the original, so
63 that any problems introduced by others will not reflect on the original
64 authors' reputations.
65
66 The precise terms and conditions for copying, distribution and
67 modification follow.
68
69 GNU GENERAL PUBLIC LICENSE
70 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
71
72 0. This License Agreement applies to any program or other work which
73 contains a notice placed by the copyright holder saying it may be
74 distributed under the terms of this General Public License. The
75 "Program", below, refers to any such program or work, and a "work based
76 on the Program" means either the Program or any work containing the
77 Program or a portion of it, either verbatim or with modifications. Each
78 licensee is addressed as "you".
79
80 1. You may copy and distribute verbatim copies of the Program's source
81 code as you receive it, in any medium, provided that you conspicuously and
82 appropriately publish on each copy an appropriate copyright notice and
83 disclaimer of warranty; keep intact all the notices that refer to this
84 General Public License and to the absence of any warranty; and give any
85 other recipients of the Program a copy of this General Public License
86 along with the Program. You may charge a fee for the physical act of
87 transferring a copy.
88
89 2. You may modify your copy or copies of the Program or any portion of
90 it, and copy and distribute such modifications under the terms of Paragraph
91 1 above, provided that you also do the following:
92
93 a) cause the modified files to carry prominent notices stating that
94 you changed the files and the date of any change; and
95
96 b) cause the whole of any work that you distribute or publish, that
97 in whole or in part contains the Program or any part thereof, either
98 with or without modifications, to be licensed at no charge to all
99 third parties under the terms of this General Public License (except
100 that you may choose to grant warranty protection to some or all
101 third parties, at your option).
102
103 c) If the modified program normally reads commands interactively when
104 run, you must cause it, when started running for such interactive use
105 in the simplest and most usual way, to print or display an
106 announcement including an appropriate copyright notice and a notice
107 that there is no warranty (or else, saying that you provide a
108 warranty) and that users may redistribute the program under these
109 conditions, and telling the user how to view a copy of this General
110 Public License.
111
112 d) You may charge a fee for the physical act of transferring a
113 copy, and you may at your option offer warranty protection in
114 exchange for a fee.
115
116 Mere aggregation of another independent work with the Program (or its
117 derivative) on a volume of a storage or distribution medium does not bring
118 the other work under the scope of these terms.
119
120 3. You may copy and distribute the Program (or a portion or derivative of
121 it, under Paragraph 2) in object code or executable form under the terms of
122 Paragraphs 1 and 2 above provided that you also do one of the following:
123
124 a) accompany it with the complete corresponding machine-readable
125 source code, which must be distributed under the terms of
126 Paragraphs 1 and 2 above; or,
127
128 b) accompany it with a written offer, valid for at least three
129 years, to give any third party free (except for a nominal charge
130 for the cost of distribution) a complete machine-readable copy of the
131 corresponding source code, to be distributed under the terms of
132 Paragraphs 1 and 2 above; or,
133
134 c) accompany it with the information you received as to where the
135 corresponding source code may be obtained. (This alternative is
136 allowed only for noncommercial distribution and only if you
137 received the program in object code or executable form alone.)
138
139 Source code for a work means the preferred form of the work for making
140 modifications to it. For an executable file, complete source code means
141 all the source code for all modules it contains; but, as a special
142 exception, it need not include source code for modules which are standard
143 libraries that accompany the operating system on which the executable
144 file runs, or for standard header files or definitions files that
145 accompany that operating system.
146
147 4. You may not copy, modify, sublicense, distribute or transfer the
148 Program except as expressly provided under this General Public License.
149 Any attempt otherwise to copy, modify, sublicense, distribute or transfer
150 the Program is void, and will automatically terminate your rights to use
151 the Program under this License. However, parties who have received
152 copies, or rights to use copies, from you under this General Public
153 License will not have their licenses terminated so long as such parties
154 remain in full compliance.
155
156 5. By copying, distributing or modifying the Program (or any work based
157 on the Program) you indicate your acceptance of this license to do so,
158 and all its terms and conditions.
159
160 6. Each time you redistribute the Program (or any work based on the
161 Program), the recipient automatically receives a license from the original
162 licensor to copy, distribute or modify the Program subject to these
163 terms and conditions. You may not impose any further restrictions on the
164 recipients' exercise of the rights granted herein.
165
166 7. The Free Software Foundation may publish revised and/or new versions
167 of the General Public License from time to time. Such new versions will
168 be similar in spirit to the present version, but may differ in detail to
169 address new problems or concerns.
170
171 Each version is given a distinguishing version number. If the Program
172 specifies a version number of the license which applies to it and "any
173 later version", you have the option of following the terms and conditions
174 either of that version or of any later version published by the Free
175 Software Foundation. If the Program does not specify a version number of
176 the license, you may choose any version ever published by the Free Software
177 Foundation.
178
179 8. If you wish to incorporate parts of the Program into other free
180 programs whose distribution conditions are different, write to the author
181 to ask for permission. For software which is copyrighted by the Free
182 Software Foundation, write to the Free Software Foundation; we sometimes
183 make exceptions for this. Our decision will be guided by the two goals
184 of preserving the free status of all derivatives of our free software and
185 of promoting the sharing and reuse of software generally.
186
187 NO WARRANTY
188
189 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
190 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
191 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
192 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
193 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
194 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
195 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
196 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
197 REPAIR OR CORRECTION.
198
199 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
200 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
201 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
202 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
203 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
204 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
205 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
206 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
207 POSSIBILITY OF SUCH DAMAGES.
208
209 END OF TERMS AND CONDITIONS
210
211 Appendix: How to Apply These Terms to Your New Programs
212
213 If you develop a new program, and you want it to be of the greatest
214 possible use to humanity, the best way to achieve this is to make it
215 free software which everyone can redistribute and change under these
216 terms.
217
218 To do so, attach the following notices to the program. It is safest to
219 attach them to the start of each source file to most effectively convey
220 the exclusion of warranty; and each file should have at least the
221 "copyright" line and a pointer to where the full notice is found.
222
223 <one line to give the program's name and a brief idea of what it does.>
224 Copyright (C) 19yy <name of author>
225
226 This program is free software; you can redistribute it and/or modify
227 it under the terms of the GNU General Public License as published by
228 the Free Software Foundation; either version 1, or (at your option)
229 any later version.
230
231 This program is distributed in the hope that it will be useful,
232 but WITHOUT ANY WARRANTY; without even the implied warranty of
233 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
234 GNU General Public License for more details.
235
236 You should have received a copy of the GNU General Public License
237 along with this program; if not, write to the Free Software Foundation,
238 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
239
240 Also add information on how to contact you by electronic and paper mail.
241
242 If the program is interactive, make it output a short notice like this
243 when it starts in an interactive mode:
244
245 Gnomovision version 69, Copyright (C) 19xx name of author
246 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
247 This is free software, and you are welcome to redistribute it
248 under certain conditions; type `show c' for details.
249
250 The hypothetical commands `show w' and `show c' should show the
251 appropriate parts of the General Public License. Of course, the
252 commands you use may be called something other than `show w' and `show
253 c'; they could even be mouse-clicks or menu items--whatever suits your
254 program.
255
256 You should also get your employer (if you work as a programmer) or your
257 school, if any, to sign a "copyright disclaimer" for the program, if
258 necessary. Here a sample; alter the names:
259
260 Yoyodyne, Inc., hereby disclaims all copyright interest in the
261 program `Gnomovision' (a program to direct compilers to make passes
262 at assemblers) written by James Hacker.
263
264 <signature of Ty Coon>, 1 April 1989
265 Ty Coon, President of Vice
266
267 That's all there is to it!
268
269
270 --- The Artistic License 1.0 ---
271
272 This software is Copyright (c) 2008 by the POE authors.
273
274 This is free software, licensed under:
275
276 The Artistic License 1.0
277
278 The Artistic License
279
280 Preamble
281
282 The intent of this document is to state the conditions under which a Package
283 may be copied, such that the Copyright Holder maintains some semblance of
284 artistic control over the development of the package, while giving the users of
285 the package the right to use and distribute the Package in a more-or-less
286 customary fashion, plus the right to make reasonable modifications.
287
288 Definitions:
289
290 - "Package" refers to the collection of files distributed by the Copyright
291 Holder, and derivatives of that collection of files created through
292 textual modification.
293 - "Standard Version" refers to such a Package if it has not been modified,
294 or has been modified in accordance with the wishes of the Copyright
295 Holder.
296 - "Copyright Holder" is whoever is named in the copyright or copyrights for
297 the package.
298 - "You" is you, if you're thinking about copying or distributing this Package.
299 - "Reasonable copying fee" is whatever you can justify on the basis of media
300 cost, duplication charges, time of people involved, and so on. (You will
301 not be required to justify it to the Copyright Holder, but only to the
302 computing community at large as a market that must bear the fee.)
303 - "Freely Available" means that no fee is charged for the item itself, though
304 there may be fees involved in handling the item. It also means that
305 recipients of the item may redistribute it under the same conditions they
306 received it.
307
308 1. You may make and give away verbatim copies of the source form of the
309 Standard Version of this Package without restriction, provided that you
310 duplicate all of the original copyright notices and associated disclaimers.
311
312 2. You may apply bug fixes, portability fixes and other modifications derived
313 from the Public Domain or from the Copyright Holder. A Package modified in such
314 a way shall still be considered the Standard Version.
315
316 3. You may otherwise modify your copy of this Package in any way, provided that
317 you insert a prominent notice in each changed file stating how and when you
318 changed that file, and provided that you do at least ONE of the following:
319
320 a) place your modifications in the Public Domain or otherwise make them
321 Freely Available, such as by posting said modifications to Usenet or an
322 equivalent medium, or placing the modifications on a major archive site
323 such as ftp.uu.net, or by allowing the Copyright Holder to include your
324 modifications in the Standard Version of the Package.
325
326 b) use the modified Package only within your corporation or organization.
327
328 c) rename any non-standard executables so the names do not conflict with
329 standard executables, which must also be provided, and provide a separate
330 manual page for each non-standard executable that clearly documents how it
331 differs from the Standard Version.
332
333 d) make other distribution arrangements with the Copyright Holder.
334
335 4. You may distribute the programs of this Package in object code or executable
336 form, provided that you do at least ONE of the following:
337
338 a) distribute a Standard Version of the executables and library files,
339 together with instructions (in the manual page or equivalent) on where to
340 get the Standard Version.
341
342 b) accompany the distribution with the machine-readable source of the Package
343 with your modifications.
344
345 c) accompany any non-standard executables with their corresponding Standard
346 Version executables, giving the non-standard executables non-standard
347 names, and clearly documenting the differences in manual pages (or
348 equivalent), together with instructions on where to get the Standard
349 Version.
350
351 d) make other distribution arrangements with the Copyright Holder.
352
353 5. You may charge a reasonable copying fee for any distribution of this
354 Package. You may charge any fee you choose for support of this Package. You
355 may not charge a fee for this Package itself. However, you may distribute this
356 Package in aggregate with other (possibly commercial) programs as part of a
357 larger (possibly commercial) software distribution provided that you do not
358 advertise this Package as a product of your own.
359
360 6. The scripts and library files supplied as input to or produced as output
361 from the programs of this Package do not automatically fall under the copyright
362 of this Package, but belong to whomever generated them, and may be sold
363 commercially, and may be aggregated with this Package.
364
365 7. C or perl subroutines supplied by you and linked into this Package shall not
366 be considered part of this Package.
367
368 8. The name of the Copyright Holder may not be used to endorse or promote
369 products derived from this software without specific prior written permission.
370
371 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
372 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
373 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
374
375 The End
376
00 Build.PL
1 Changes
2 Makefile.PL
31 MANIFEST
42 MANIFEST.SKIP
3 README
4 Makefile.PL
55 META.yml
6 README
6 Changes
77 LICENSE
88
99 lib/POE/Component/SSLify.pm
1414 examples/server.pl
1515 examples/serverclient.pl
1616
17 mylib/example.crt
18 mylib/example.key
19
1720 t/1_load.t
1821 t/apocalypse.t
22 t/simple.t
0 # Avoid Eclipse stuff
1 \.includepath$
2 \.project$
3 \.settings/
4
5 # Avoid version control files.
6 \B\.svn\b
7 \B\.git\b
8
9 # Avoid Makemaker generated and utility files.
10 \bMakefile$
11 \bblib/
12 \bMakeMaker-\d
13 \bpm_to_blib$
14
15 # Avoid Module::Build generated and utility files.
16 \bBuild$
17 \b_build/
18
19 # Avoid temp and backup files.
20 ~$
21 \.old$
22 \#$
23 \b\.#
24 \.bak$
25
26 # our tarballs
27 \.tar\.gz$
0 # skip Eclipse IDE stuff
1 \.includepath$
2 \.project$
3 \.settings/
4
5 # Avoid version control files.
6 \B\.svn\b
7 \B\.git\b
8
9 # Avoid Makemaker generated and utility files.
10 \bMakefile$
11 \bblib/
12 \bMakeMaker-\d
13 \bpm_to_blib$
14
15 # Avoid Module::Build generated and utility files.
16 \bBuild$
17 \b_build/
18 ^MYMETA.yml$
19
20 # Avoid temp and backup files.
21 ~$
22 \.old$
23 \#$
24 \b\.#
25 \.bak$
26
27 # our tarballs
28 \.tar\.gz$
00 #!/usr/bin/perl
11 use strict; use warnings;
2
3 # to use experimental nonblocking, uncomment this line
4 #sub POE::Component::SSLify::NONBLOCKING { 1 }
52
63 use POE;
74 use POE::Component::SSLify qw( Client_SSLify );
2926 'do_connect' => sub {
3027 # Create the socketfactory wheel to listen for requests
3128 $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new(
32 'RemotePort' => 5432,
29 'RemotePort' => 9898,
3330 'RemoteAddress' => 'localhost',
3431 'Reuse' => 'yes',
3532 'SuccessEvent' => 'Got_Connection',
00 #!/usr/bin/perl
11 use strict; use warnings;
2
3 # to use experimental nonblocking, uncomment this line
4 #sub POE::Component::SSLify::NONBLOCKING { 1 }
52
63 use POE;
74 use Socket qw( inet_ntoa unpack_sockaddr_in );
1411 POE::Session->create(
1512 'inline_states' => {
1613 '_start' => sub {
17 # Okay, set the SSL options
18 SSLify_Options( 'server.key', 'server.crt' );
14 # Okay, set the SSL certificate info
15 eval {
16 SSLify_Options( 'mylib/example.key', 'mylib/example.crt' );
17 };
18 SSLify_Options( '../mylib/example.key', '../mylib/example.crt' ) if ( $@ );
1919
2020 # Set the alias
2121 $_[KERNEL]->alias_set( 'main' );
2222
2323 # Create the socketfactory wheel to listen for requests
2424 $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new(
25 'BindPort' => 5432,
25 'BindPort' => 9898,
2626 'BindAddress' => 'localhost',
2727 'Reuse' => 'yes',
2828 'SuccessEvent' => 'Got_Connection',
00 #!/usr/bin/perl
11 use strict; use warnings;
2
3 # to use experimental nonblocking, uncomment this line
4 #sub POE::Component::SSLify::NONBLOCKING { 1 }
52
63 use POE;
74 use Socket qw( inet_ntoa unpack_sockaddr_in );
1613 POE::Session->create(
1714 'inline_states' => {
1815 '_start' => sub {
19 # Okay, set the SSL options
20 SSLify_Options( 'server.key', 'server.crt' );
16 # Okay, set the SSL certificate info
17 eval {
18 SSLify_Options( 'mylib/example.key', 'mylib/example.crt' );
19 };
20 SSLify_Options( '../mylib/example.key', '../mylib/example.crt' ) if ( $@ );
2121
2222 # Set the alias
2323 $_[KERNEL]->alias_set( 'server' );
2424
2525 # Create the socketfactory wheel to listen for requests
2626 $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new(
27 'BindPort' => 5432,
27 'BindPort' => 9898,
2828 'BindAddress' => 'localhost',
2929 'Reuse' => 'yes',
3030 'SuccessEvent' => 'Got_Connection',
103103 'do_connect' => sub {
104104 # Create the socketfactory wheel to listen for requests
105105 $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new(
106 'RemotePort' => 5432,
106 'RemotePort' => 9898,
107107 'RemoteAddress' => 'localhost',
108108 'Reuse' => 'yes',
109109 'SuccessEvent' => 'Got_Connection',
0 # $Id: ClientHandle.pm 53 2008-07-28 03:03:04Z larwan $
10 package POE::Component::SSLify::ClientHandle;
21 use strict; use warnings;
32
43 # Initialize our version
54 use vars qw( $VERSION );
6 $VERSION = '0.15';
5 $VERSION = '0.16';
76
87 # Import the SSL death routines
98 use Net::SSLeay qw( die_now die_if_ssl_error );
2827
2928 Net::SSLeay::set_fd( $ssl, $fileno ); # Must use fileno
3029
30 # Socket is in non-blocking mode, so connect() will return immediately.
31 # die_if_ssl_error won't die on non-blocking errors. We don't need to call connect()
32 # again, because OpenSSL I/O functions (read, write, ...) can handle that entirely
33 # by self (it's needed to connect() once to determine connection type).
3134 my $resp = Net::SSLeay::connect( $ssl ) or die_if_ssl_error( 'ssl connect' );
3235
3336 my $self = bless {
7073
7174 =head1 COPYRIGHT AND LICENSE
7275
73 Copyright 2009 by Apocalypse
76 Copyright 2010 by Apocalypse
7477
7578 This library is free software; you can redistribute it and/or modify
7679 it under the same terms as Perl itself.
0 # $Id: ServerHandle.pm 53 2008-07-28 03:03:04Z larwan $
10 package POE::Component::SSLify::ServerHandle;
21 use strict; use warnings;
32
43 # Initialize our version
54 use vars qw( $VERSION );
6 $VERSION = '0.15';
5 $VERSION = '0.16';
76
87 # Import the SSL death routines
98 use Net::SSLeay qw( die_now die_if_ssl_error );
1817
1918 Net::SSLeay::set_fd( $ssl, $fileno );
2019
20 # Socket is in non-blocking mode, so accept() will return immediately.
21 # die_if_ssl_error won't die on non-blocking errors. We don't need to call accept()
22 # again, because OpenSSL I/O functions (read, write, ...) can handle that entirely
23 # by self (it's needed to accept() once to determine connection type).
2124 my $err = Net::SSLeay::accept( $ssl ) and die_if_ssl_error( 'ssl accept' );
2225
2326 my $self = bless {
8487 my $wrote_len = Net::SSLeay::write( $self->{'ssl'}, substr( $buf, $offset, $len ) );
8588
8689 # Did we get an error or number of bytes written?
87 # Net::SSLeay::write() returns the number of bytes written, or -1 on error.
90 # Net::SSLeay::write() returns the number of bytes written, or 0 on unsuccessful
91 # operation (probably connection closed), or -1 on error.
8892 if ( $wrote_len < 0 ) {
8993 # The normal syswrite() POE uses expects 0 here.
9094 return 0;
185189
186190 Apocalypse E<lt>apocal@cpan.orgE<gt>
187191
188 =head1 PROPS
189
190 Original code is entirely Rocco Caputo ( Creator of POE ) -> I simply
191 packaged up the code into something everyone could use...
192
193 From the PoCo::Client::HTTP code for blocking sockets =]
194 # TODO - This code should probably become a POE::Kernel method,
195 # seeing as it's rather baroque and potentially useful in a number
196 # of places.
197
198192 =head1 COPYRIGHT AND LICENSE
199193
200 Copyright 2009 by Apocalypse/Rocco Caputo
194 Copyright 2010 by Apocalypse
201195
202196 This library is free software; you can redistribute it and/or modify
203197 it under the same terms as Perl itself.
0 # $Id: SSLify.pm 53 2008-07-28 03:03:04Z larwan $
10 package POE::Component::SSLify;
21 use strict; use warnings;
32
43 # Initialize our version
54 use vars qw( $VERSION );
6 $VERSION = '0.15';
5 $VERSION = '0.16';
76
87 # We need Net::SSLeay or all's a failure!
98 BEGIN {
2120 }
2221
2322 # Finally, load our subclass :)
23 # ClientHandle isa ServerHandle so it will get loaded automatically
2424 require POE::Component::SSLify::ClientHandle;
25 require POE::Component::SSLify::ServerHandle;
2625
2726 # Initialize Net::SSLeay
2827 Net::SSLeay::load_error_strings();
2928 Net::SSLeay::SSLeay_add_ssl_algorithms();
3029 Net::SSLeay::randomize();
31
32 # set nonblocking mode?
33 if ( ! defined &NONBLOCKING ) { *NONBLOCKING = sub () { 0 } }
3430 }
3531 }
3632
5046 # The server-side CTX stuff
5147 my $ctx = undef;
5248
53 # Helper sub to set blocking on a handle
54 sub Set_Blocking {
49 # Helper sub to set nonblocking on a handle
50 sub _NonBlocking {
5551 my $socket = shift;
5652
57 # skip this? ( experimental )
58 return $socket if NONBLOCKING();
59
60 # Net::SSLeay needs blocking for setup.
61 #
6253 # ActiveState Perl 5.8.0 dislikes the Win32-specific code to make
63 # a socket blocking, so we use IO::Handle's blocking(1) method.
54 # a socket blocking, so we use IO::Handle's blocking(0) method.
6455 # Perl 5.005_03 doesn't like blocking(), so we only use it in
6556 # 5.8.0 and beyond.
6657 if ( $] >= 5.008 and $^O eq 'MSWin32' ) {
6758 # From IO::Handle POD
6859 # If an error occurs blocking will return undef and $! will be set.
69 if ( ! $socket->blocking( 1 ) ) {
70 die "Unable to set blocking mode on socket: $!";
60 if ( ! $socket->blocking( 0 ) ) {
61 die "Unable to set nonblocking mode on socket: $!";
7162 }
7263 } else {
73 # Make the handle blocking, the POSIX way.
64 # Make the handle nonblocking, the POSIX way.
7465 if ( $^O ne 'MSWin32' ) {
7566 # Get the old flags
7667 my $flags = fcntl( $socket, F_GETFL, 0 ) or die "fcntl( $socket, F_GETFL, 0 ) fails: $!";
7768
78 # Okay, we patiently wait until the socket turns blocking mode
79 until( fcntl( $socket, F_SETFL, $flags & ~O_NONBLOCK ) ) {
69 # Okay, we patiently wait until the socket turns nonblocking mode
70 until( fcntl( $socket, F_SETFL, $flags | O_NONBLOCK ) ) {
8071 # What was the error?
8172 if ( ! ( $! == EAGAIN or $! == EWOULDBLOCK ) ) {
8273 # Fatal error...
8778 # Darned MSWin32 way...
8879 # Do some ioctl magic here
8980 # 126 is FIONBIO ( some docs say 0x7F << 16 )
90 my $flag = "0";
81 my $flag = "1";
9182 ioctl( $socket, 0x80000000 | ( 4 << 16 ) | ( ord( 'f' ) << 8 ) | 126, $flag ) or die "ioctl( $socket, FIONBIO, $flag ) fails: $!";
9283 }
9384 }
10697 die "Did not get a defined socket";
10798 }
10899
109 # Set blocking on
110 $socket = Set_Blocking( $socket );
100 # Set non-blocking
101 $socket = _NonBlocking( $socket );
111102
112103 # Now, we create the new socket and bind it to our subclass of Net::SSLeay::Handle
113104 my $newsock = gensym();
133124 die 'Please do SSLify_Options() first ( or pass in a $ctx object )';
134125 }
135126
136 # Set blocking on
137 $socket = Set_Blocking( $socket );
127 # Set non-blocking
128 $socket = _NonBlocking( $socket );
138129
139130 # Now, we create the new socket and bind it to our subclass of Net::SSLeay::Handle
140131 my $newsock = gensym();
148139 # Get the key + cert + version + options
149140 my( $key, $cert, $version, $options ) = @_;
150141
151 return createSSLcontext( $key, $cert, $version, $options );
142 return _createSSLcontext( $key, $cert, $version, $options );
152143 }
153144
154145 sub SSLify_Options {
170161 Net::SSLeay::CTX_free( $ctx );
171162 undef $ctx;
172163 }
173 $ctx = createSSLcontext( $key, $cert, $version, $options );
164 $ctx = _createSSLcontext( $key, $cert, $version, $options );
174165
175166 # all done!
176167 return 1;
177168 }
178169
179 sub createSSLcontext {
170 sub _createSSLcontext {
180171 my( $key, $cert, $version, $options ) = @_;
181172
182173 my $context;
246237
247238 # End of module
248239 1;
249
250240 __END__
251241
242 =for stopwords AnnoCPAN CPAN CPANTS Kwalitee RT SSL com diff github
243
252244 =head1 NAME
253245
254246 POE::Component::SSLify - Makes using SSL in the world of POE easy!
255247
256248 =head1 SYNOPSIS
257249
258 =head2 Client-side usage
250 # CLIENT-side usage
259251
260252 # Import the module
261253 use POE::Component::SSLify qw( Client_SSLify );
262254
263255 # Create a normal SocketFactory wheel or something
264 my $factory = POE::Wheel::SocketFactory->new( ... );
265
256 my $factory = POE::Wheel::SocketFactory->new;
257
258 # Time passes, SocketFactory gives you a socket when it connects in SuccessEvent
266259 # Converts the socket into a SSL socket POE can communicate with
260 my $socket = shift;
267261 eval { $socket = Client_SSLify( $socket ) };
268262 if ( $@ ) {
269263 # Unable to SSLify it...
272266 # Now, hand it off to ReadWrite
273267 my $rw = POE::Wheel::ReadWrite->new(
274268 Handle => $socket,
275 ...
269 # other options as usual
276270 );
277271
278272 # Use it as you wish...
279
280 =head2 Server-side usage
273 # End of example
274
275 # --------------------------------------------------------------------------- #
276
277
278 # SERVER-side usage
281279
282280 # !!! Make sure you have a public key + certificate generated via Net::SSLeay's makecert.pl
283281 # excellent howto: http://www.akadia.com/services/ssh_test_certificate.html
292290 }
293291
294292 # Create a normal SocketFactory wheel or something
295 my $factory = POE::Wheel::SocketFactory->new( ... );
296
293 my $factory = POE::Wheel::SocketFactory->new;
294
295 # Time passes, SocketFactory gives you a socket when it gets a connection in SuccessEvent
297296 # Converts the socket into a SSL socket POE can communicate with
297 my $socket = shift;
298298 eval { $socket = Server_SSLify( $socket ) };
299299 if ( $@ ) {
300300 # Unable to SSLify it...
303303 # Now, hand it off to ReadWrite
304304 my $rw = POE::Wheel::ReadWrite->new(
305305 Handle => $socket,
306 ...
306 # other options as usual
307307 );
308308
309309 # Use it as you wish...
310 # End of example
310311
311312 =head1 ABSTRACT
312313
349350 Some users have reported success, others failure when they tried to utilize SSLify in both roles. This
350351 would require more investigation, so please tread carefully if you need to use it!
351352
352 =head2 Blocking mode
353
354 Normally, Net::SSLeay requires the socket to be in blocking mode for the initial handshake to work. However,
355 various users ( especially ASCENT, thanks! ) have reported success in setting nonblocking mode for clients.
356
357 In order to enable nonblocking mode, you need to set the subroutine "NONBLOCKING" to a true value in this
358 package.
359
360 sub POE::Component::SSLify::NONBLOCKING { 1 }
361 use POE::Component::SSLify;
362
363 This is a global, and an EXPERIMENTAL feature! Please, pretty please report back to me your experience with
364 this. Hopefully someday SSLify will be fully nonblocking, thanks to your help!
365
366353 =head1 FUNCTIONS
367354
368355 =head2 Client_SSLify
475462
476463 Stuffs all of the above functions in @EXPORT_OK so you have to request them directly
477464
478 head1 SUPPORT
465 =head1 SUPPORT
479466
480467 You can find documentation for this module with the perldoc command.
481468
485472
486473 =over 4
487474
475 =item * Search CPAN
476
477 L<http://search.cpan.org/dist/POE-Component-SSLify>
478
488479 =item * AnnoCPAN: Annotated CPAN documentation
489480
490481 L<http://annocpan.org/dist/POE-Component-SSLify>
493484
494485 L<http://cpanratings.perl.org/d/POE-Component-SSLify>
495486
496 =item * RT: CPAN's request tracker
487 =item * CPAN Forum
488
489 L<http://cpanforum.com/dist/POE-Component-SSLify>
490
491 =item * RT: CPAN's Request Tracker
497492
498493 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify>
499494
500 =item * Search CPAN
501
502 L<http://search.cpan.org/dist/POE-Component-SSLify>
495 =item * CPANTS Kwalitee
496
497 L<http://cpants.perl.org/dist/overview/POE-Component-SSLify>
498
499 =item * CPAN Testers Results
500
501 L<http://cpantesters.org/distro/P/POE-Component-SSLify.html>
502
503 =item * CPAN Testers Matrix
504
505 L<http://matrix.cpantesters.org/?dist=POE-Component-SSLify>
506
507 =item * Git Source Code Repository
508
509 This code is currently hosted on github.com under the account "apocalypse". Please feel free to browse it
510 and pull from it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
511 from your repository :)
512
513 L<http://github.com/apocalypse/perl-poe-sslify>
503514
504515 =back
505516
518529 =head1 AUTHOR
519530
520531 Apocalypse E<lt>apocal@cpan.orgE<gt>
521
522 =head1 PROPS
523532
524533 Original code is entirely Rocco Caputo ( Creator of POE ) -> I simply
525534 packaged up the code into something everyone could use and accepted the burden
530539 # seeing as it's rather baroque and potentially useful in a number
531540 # of places.
532541
542 ASCENT also helped a lot with the nonblocking mode, without his hard work this
543 module would still be stuck in the stone age :)
544
533545 =head1 COPYRIGHT AND LICENSE
534546
535 Copyright 2009 by Apocalypse/Rocco Caputo
547 Copyright 2010 by Apocalypse/Rocco Caputo/ascent
536548
537549 This library is free software; you can redistribute it and/or modify
538550 it under the same terms as Perl itself.
539551
552 The full text of the license can be found in the LICENSE file included with this module.
553
540554 =cut
0 -----BEGIN CERTIFICATE-----
1 MIIDIDCCAggCCQCFFIApNMYn+zANBgkqhkiG9w0BAQUFADBSMQswCQYDVQQGEwJY
2 WDETMBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MRowGAYD
3 VQQKExFTb21lLUNvbXBhbnkgTHRkLjAeFw0xMDAzMDkyMzM0NDBaFw0yMzExMTYy
4 MzM0NDBaMFIxCzAJBgNVBAYTAlhYMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYD
5 VQQHEwlTb21lLUNpdHkxGjAYBgNVBAoTEVNvbWUtQ29tcGFueSBMdGQuMIIBIjAN
6 BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy7vONqMnWdBNGEstmvJDH3vmDh/y
7 ZxgpkJhKNTIEbyo5B+m29mc860A4VNKGmi/c/Z0zx7ETu5GpTZAvVdhr9LWHKh6j
8 vH4xGfCfCCfyZtFIxEsIawpaRi2AkKRb4386NCDXdomVCiihAEn2VKS13nZaztMu
9 EwVFg3l5jIj8sHE9UJbTmbCQOJre1brAK/2l0FEfy03oCygYvtTUzYksbLNsNiG7
10 LJ/Y8opoKwdcboVzMOg1dnoY6a3J7hpDd6FSTKcpqxNltk3x1fWh+zEd0Pl3YAMF
11 uW1mIbOIuSuQD9mZqcxDIaAb/yrU5N82zh7Kkba3MCs1B6eaCWPJcDFeFwIDAQAB
12 MA0GCSqGSIb3DQEBBQUAA4IBAQBDXa1fKk1NF05/9w93q8/QDINXQhlWFZDIr5oB
13 A0rU2Rezljji92ElZCl/nGfianeCoCjA6+xMY37eUn8OOfJh1e6a45E1sRyXgZZv
14 tlZmt65K/UlZCYQ8+jEPjP+Ea/iKq3IUN0RKObOxB3QvOucx0ECfqZeiApuhkjZJ
15 I97dcD3ybwQ2rZcRzIccKQYsfnzLIzUjLlEbvyIOk6jyGKV6lZfmkeyuDbFlBdcG
16 85Ts5GpXM7lojmdz858PgNEtCEkoSO8LQSdWftsoCxWTEPdMTBPotMN0FgySO5Wr
17 d91Rn/uL5LFSGD4CV8u94IcS/qLf1IqheGUWPYZ7edwt+zQm
18 -----END CERTIFICATE-----
0 -----BEGIN RSA PRIVATE KEY-----
1 MIIEpQIBAAKCAQEAy7vONqMnWdBNGEstmvJDH3vmDh/yZxgpkJhKNTIEbyo5B+m2
2 9mc860A4VNKGmi/c/Z0zx7ETu5GpTZAvVdhr9LWHKh6jvH4xGfCfCCfyZtFIxEsI
3 awpaRi2AkKRb4386NCDXdomVCiihAEn2VKS13nZaztMuEwVFg3l5jIj8sHE9UJbT
4 mbCQOJre1brAK/2l0FEfy03oCygYvtTUzYksbLNsNiG7LJ/Y8opoKwdcboVzMOg1
5 dnoY6a3J7hpDd6FSTKcpqxNltk3x1fWh+zEd0Pl3YAMFuW1mIbOIuSuQD9mZqcxD
6 IaAb/yrU5N82zh7Kkba3MCs1B6eaCWPJcDFeFwIDAQABAoIBAQDAWYEZHrMBXePb
7 4uac2su6xuxuO4VOBob/qHivfpinJ9MOgH8oZlIivdAxbU599mCL5cbEa4/40E5r
8 F41JXHqYYGbLwn/Ob8oF9qL/PU/j+QXdpgW9odmXVlCCv1quECmwm60xkjXvkGpp
9 bmsugQ/giBe2G7XtaVW3CpJSt+by4VW+qf8ke3Y8TQHoW+dUPiexb9KFFTvy9i1O
10 HV1Z3pQ3Y8yH1qb5xzCNYv1/ofjbAMlv1Cf9CHpAnIWlXA7QCb1VktF2eMjv435d
11 oxhEhYidARWZfxiYRcewt0FfPU7/yDZXgphLSrQLWEJs6bOxDRhA6l/cOcQX/XG1
12 t7I5I9JhAoGBAPuweXOTUEfZdrveXM5716/o+qYMZC330LvOqbpJnB5up8cPR9sl
13 VB1dZqFMYdFTVD9oPKPY726RxptE8ylShhe5LuPRjF3/aYmXlrQROSJJ5uJ5exr9
14 mJjXaRp9AW8wTOqDkHbiyb+WrpVL5klYHvgnJrivokzc246tdsvADJ6xAoGBAM85
15 EgTQhHT5OFe4bQavROd8khuTTD3iGQQO0cR5Oh8EjbMc3ejp7qUE41I30DoFpn64
16 uOiQzxzpOJFGiid+8FoG7k2/K96j0j9JiBNv93Te1OhOvG+2JirrygoM9E3ofmF5
17 trDpCVgs5+mAkdJctmpXME5PPmEKo5+b2cK9S8tHAoGAS5s0sLJVEHBUCZV/nYt4
18 PGCpQs5AHcruyiwHsm1AV6f4AIUnmb456WRQWy3dyIrWqQGADdwx+K4T0jrBLO2c
19 WG4Jlugw2V/LbUi7PbZaymEW2XuSroX1nBxBd3KLxsHkqSICeKQh5Mq4ASM+t1Og
20 Yf0o1Zv1Dk/eKJsVL5mucNECgYEAst3nIMK/4pwQNx+Y9DErf8i18Rl2sN/NigQk
21 qrudIJL0oMtk/JuYA1axxREqKjsgWLen3A7Kx4DD9Bn4PFlEq+DZp8BA5L9xRnF5
22 BJYb+gQxsIft/VsznM7EKWK/KdRp6kd+Gzw7daHlWFdDB1pBlo7FwoKCLI9bZvTG
23 xWJR3xcCgYEAyHPtp36K2epbFkpCf5pmtWCVk4lRNs6MSE0aJmbqZhRW971V81ev
24 xa2DZj3KHcXCfDW5Dnjiyx9qf7GS1ts9dfWyKjr6qEwBcGQMXW3C6p9fuFXkxGhe
25 Yx2KYA48kiY5Rj5wTpixwdq3YWASlZOQs282UEb+cxZHxpT2YUiIJkc=
26 -----END RSA PRIVATE KEY-----
77 } else {
88 # lousy hack for kwalitee
99 require Test::NoWarnings; require Test::Pod; require Test::Pod::Coverage;
10 is_apocalypse_here();
10 is_apocalypse_here( {
11 deny => qr/^(?:(?:OutdatedPrereq|Dependencie)s|ModuleUsed|Strict|Fixme|Pod_Spelling)$/,
12 } );
1113 }
0 #!/usr/bin/perl
1
2 use strict;
3 use warnings;
4 use Test::More tests => 22;
5
6 use POE;
7 use POE::Component::Client::TCP;
8 use POE::Component::Server::TCP;
9 use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate/;
10 use Net::SSLeay qw/ERROR_WANT_READ ERROR_WANT_WRITE/;
11 use POSIX qw/F_GETFL F_SETFL O_NONBLOCK EAGAIN EWOULDBLOCK/;
12
13 # TODO rewrite this to use Test::POE::Server::TCP and stuff :)
14
15 my $port;
16
17 POE::Component::Server::TCP->new
18 (
19 Alias => 'myserver',
20 Address => '127.0.0.1',
21 Port => 0,
22
23 Started => sub
24 {
25 use Socket qw/sockaddr_in/;
26 $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0];
27 },
28 ClientConnected => sub
29 {
30 ok(1, 'SERVER: accepted');
31 },
32 ClientDisconnected => sub
33 {
34 ok(1, 'SERVER: client disconnected');
35 $_[KERNEL]->post(myserver => 'shutdown');
36 },
37 ClientPreConnect => sub
38 {
39 eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') };
40 eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@);
41 ok(!$@, "SERVER: SSLify_Options $@");
42
43 my $socket = eval { Server_SSLify($_[ARG0]) };
44 ok(!$@, "SERVER: Server_SSLify $@");
45 ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket));
46
47 my $flags = fcntl($_[ARG0], F_GETFL, 0);
48 ok($flags & O_NONBLOCK, 'SERVER: SSLified socket is non-blocking?');
49
50 return ($socket);
51 },
52 ClientInput => sub
53 {
54 my ($kernel, $heap, $request) = @_[KERNEL, HEAP, ARG0];
55
56 ## At this point, connection MUST be encrypted.
57 my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle);
58 ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher");
59
60 if ($request eq 'ping')
61 {
62 ok(1, "SERVER: recv: $request");
63 $heap->{client}->put("pong");
64 }
65 elsif ($request eq 'ping2')
66 {
67 ok(1, "SERVER: recv: $request");
68 $heap->{client}->put("pong2");
69 }
70 },
71 );
72
73 POE::Component::Client::TCP->new
74 (
75 Alias => 'myclient',
76 RemoteAddress => '127.0.0.1',
77 RemotePort => $port,
78 Connected => sub
79 {
80 ok(1, 'CLIENT: connected');
81
82 $_[HEAP]->{server}->put("ping");
83 },
84 PreConnect => sub
85 {
86 my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') };
87 ok(!$@, "CLIENT: SSLify_ContextCreate $@");
88 my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) };
89 ok(!$@, "CLIENT: Client_SSLify $@");
90 ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket));
91
92 my $flags = fcntl($_[ARG0], F_GETFL, 0);
93 ok($flags & O_NONBLOCK, 'CLIENT: SSLified socket is non-blocking?');
94
95 return ($socket);
96 },
97 ServerInput => sub
98 {
99 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
100
101 ## At this point, connection MUST be encrypted.
102 my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle);
103 ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher");
104
105 if ($line eq 'pong')
106 {
107 ok(1, "CLIENT: recv: $line");
108
109 ## Force SSL renegotiation
110 my $ssl = tied(*{$heap->{server}->get_output_handle})->{ssl};
111 my $reneg_num = Net::SSLeay::num_renegotiations($ssl);
112
113 ok(1 == Net::SSLeay::renegotiate($ssl), 'CLIENT: SSL renegotiation');
114 my $handshake = Net::SSLeay::do_handshake($ssl);
115 my $err = Net::SSLeay::get_error($ssl, $handshake);
116
117 ## 1 == Successful handshake, ERROR_WANT_(READ|WRITE) == non-blocking.
118 ok($handshake == 1 || $err == ERROR_WANT_READ || $err == ERROR_WANT_WRITE, 'CLIENT: SSL handshake');
119 ok($reneg_num < Net::SSLeay::num_renegotiations($ssl), 'CLIENT: Increased number of negotiations');
120
121 $heap->{server}->put('ping2');
122 }
123
124 elsif ($line eq 'pong2')
125 {
126 ok(1, "CLIENT: recv: $line");
127 $kernel->yield('shutdown');
128 }
129 },
130 );
131
132 $poe_kernel->run();
133 exit 0;