Codebase list libpoe-component-sslify-perl / 09d22b3
* New upstream release * Refresh copyright information * Bump package to debhelper 8 * Add myself to Uploaders and Copyright * Slight rewrite of control description Jonathan Yu 13 years ago
32 changed file(s) with 2195 addition(s) and 878 deletion(s). Raw diff Collapse all Expand all
0 # Build.PL
1 use strict; use warnings;
2 use Module::Build;
30
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',
1 use strict;
2 use warnings;
93
10 'dist_abstract' => 'SSL in the world of POE made easy',
11 'dist_author' => 'Apocalypse <APOCAL@cpan.org>',
4 use Module::Build 0.3601;
125
13 'create_packlist' => 1,
14 'create_makefile_pl' => 'traditional',
15 'create_readme' => 1,
16 'create_license' => 1,
17 'sign' => 0,
186
19 'test_files' => 't/*.t',
20
21 'requires' => {
22 # Networking
23 'Net::SSLeay' => '1.36',
24
25 # minimum perl version
26 'perl' => '5.006',
27 },
28
29 'build_requires' => {
30 # For the t/simple.t test
31 'POE' => '1.267',
32 'POE::Component::Client::TCP' => 0,
33 'POE::Component::Server::TCP' => 0,
34 },
35
36 # include the standard stuff in META.yml
37 'meta_merge' => {
38 'resources' => {
39 'license' => 'http://dev.perl.org/licenses/',
40 'homepage' => 'http://search.cpan.org/dist/POE-Component-SSLify',
41 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify',
42 'repository' => 'http://github.com/apocalypse/perl-poe-sslify',
43 },
44 },
7 my %module_build_args = (
8 'build_requires' => {
9 'File::Find' => '0',
10 'File::Temp' => '0',
11 'Module::Build' => '0.3601',
12 'POE' => '1.267',
13 'POE::Component::Client::TCP' => '0',
14 'POE::Component::Server::TCP' => '0',
15 'Socket' => '0',
16 'Test::More' => '0.88'
17 },
18 'configure_requires' => {
19 'Module::Build' => '0.3601'
20 },
21 'dist_abstract' => 'Makes using SSL in the world of POE easy!',
22 'dist_author' => [
23 'Apocalypse <APOCAL@cpan.org>'
24 ],
25 'dist_name' => 'POE-Component-SSLify',
26 'dist_version' => '1.002',
27 'license' => 'perl',
28 'module_name' => 'POE::Component::SSLify',
29 'recommends' => {},
30 'recursive_test_files' => 1,
31 'requires' => {
32 'Exporter' => '0',
33 'IO::Handle' => '1.28',
34 'Net::SSLeay' => '0',
35 'Symbol' => '0',
36 'perl' => '5.006',
37 'vars' => '0'
38 },
39 'script_files' => []
4540 );
4641
47 # all done!
42
43 my $build = Module::Build->new(%module_build_args);
44
4845 $build->create_build_script;
00 Revision history for Perl extension POE::Component::SSLify.
11
2 * 0.20
2 1.002
3 Released: 2011-02-20 04:23:48 UTC
4
5 Add SSLify_GetSSL to get the Net::SSLeay object, thanks mordy@irc!
6
7 1.001
8 Released: 2011-02-13 18:11:07 UTC
9
10 Fixed the Net::SSLeay import code, thanks CPANTesters!
11
12 1.000
13 Released: 2011-02-13 00:06:14 UTC
14
15 Converted to Dist::Zilla for the release process!
16 Add a test for in-situ sslification, thanks mordy@irc!
17 Add prereq for IO::Handle 1.28 to get sane $socket->blocking( 0 ) behavior on MSWin32
18 Remove crufty old code for nonblocking and use $socket->blocking() instead
19
20 0.20
321
422 Split up the simple.t test into 2 tests for clarity, and added more diag messages for renegotiate, thanks HMBRAND!
523
6 * 0.19
24 0.19
725
826 Fixed a warning generated by POE::Component::Client::TCP in t/simple.t, thanks HMBRAND!
927
10 * 0.18
28 0.18
1129
1230 Bumped POE dep to at least 1.267 for t/simple.t - thanks CPANTesters!
1331 Minor typo fixes in POD/Build.PL
1432
15 * 0.17
33 0.17
1634
1735 Fixed the t/simple.t test to PASS on FreeBSD because Net::SSLeay::renegotiate was buggy on it, thanks CPANTesters!
1836 Added note about OpenSSL functions in the POD.
1937
20 * 0.16
38 0.16
2139
2240 Updated the nonblocking code to be production-ready, thanks ASCENT!
2341 Removed the NONBLOCKING() sub, this module is now always nonblocking.
2644 Misc kwalitee and POD fixes.
2745 Bumped Net::SSLeay prereq to 1.36 so we have the latest SSL stuff to ensure sanity :)
2846
29 * 0.15
47 0.15
3048
3149 Added "examples/serverclient.pl" to track down same-process sslification problems, thanks LotR!
3250
3654
3755 Added experimental NONBLOCKING code, thanks ASCENT for the motivation!
3856
39 * 0.14
57 0.14
4058
4159 removed Test::* modules from dependency list, thanks BINGOS - RT #36725
4260
4462
4563 added Build.PL
4664
47 * 0.13
65 0.13
4866
4967 POD typo errors in SSLify_ContextCreate - thanks ASCENT!
5068
51 * 0.12
69 0.12
5270
5371 Kwalitee-related fixes
5472
55 * 0.11
73 0.11
5674
5775 allowed setting of client-side context ( $ctx ) object - thanks RT #34442
5876
6482
6583 backported Net::SSLeay's removal of %Filenum_Objects hash
6684
67 * 0.10
85 0.10
6886
6987 More tweaks of POD - finally close RT #31238
7088 Added SSL version support - thanks RT #31492
7189 Added SSL CTX option support as a side effect
7290 Added client.pl example with ReadLine support
7391
74 * 0.09
92 0.09
7593
7694 Minor tweak of POD to enable better distro building - thanks RT #31238
7795
78 * 0.08
96 0.08
7997
8098 Added support for BINMODE - thanks RT #27117
8199
82 * 0.07
100 0.07
83101
84102 Fixed undefined $info - thanks RT #22372
85103
86 * 0.06
104 0.06
87105
88106 Kwalitee-related fixes
89107
90 * 0.05
108 0.05
91109
92110 Finally use a Changes file - thanks RT #18981
93111 Documentation tweaks
94112 Upgraded Net::SSLeay requirement to 1.30 to help Win32 problems
95113
96 * 0.04
114 0.04
97115
98116 Added new functions to extract data from the SSL socket -> GetCipher and GetSocket
99117 In the case somebody knows Net::SSLeay more than me, added GetCTX to return the server-side CTX object
100118 Removed the dependency on Net::SSLeay::Handle
101119
102 * 0.03
120 0.03
103121
104122 First stab at the server-side code, help me test it out!
105123 Refactored SSLify() into client/server side, so update your program accordingly!
106124
107 * 0.02
125 0.02
108126
109127 Made sure the IO::Handle way was used only on MSWin32
110128
113131 Oops, forgot to override _get_self and _get_ssl
114132 Fixed a nasty leak issue
115133
116 * 0.01
134 0.01
117135
118136 Initial release
0 ==============================
1 9999-99-99 99:99:99 +0000 HEAD
2 ==============================
3
4 commit b4269ddff7e04f09a8f304891469fbdc962e740c
5 Author: Apocalypse <perl@0ne.us>
6 Date: Sat Feb 19 21:19:21 2011 -0700
7
8 Add SSLify_GetSSL function, thanks mordy
9
10 =======================================
11 2011-02-13 11:11:22 -0700 release-1.001
12 =======================================
13
14 commit 6f65b4c33c787f306ec32033f6445be4b5b59516
15 Author: Apocalypse <perl@0ne.us>
16 Date: Sun Feb 13 11:11:22 2011 -0700
17
18 New CPAN release of POE-Component-SSLify - v1.001
19
20 Released: 2011-02-13 18:11:07 UTC
21
22 Fixed the Net::SSLeay import code, thanks CPANTesters!
23
24 commit 1627d797b6cd2a8a42de31312f699a5e514494ae
25 Author: Apocalypse <perl@0ne.us>
26 Date: Sun Feb 13 11:10:05 2011 -0700
27
28 use string eval instead of block eval, thanks CPANTesters
29
30 ===================================
31 End of changes in the last 365 days
32 ===================================
0
1 This is the Perl distribution POE-Component-SSLify.
2
3 Installing POE-Component-SSLify is straightforward.
4
5 ## Installation with cpanm
6
7 If you have cpanm, you only need one line:
8
9 % cpanm POE::Component::SSLify
10
11 If you are installing into a system-wide directory, you may need to pass the
12 "-S" flag to cpanm, which uses sudo to install the module:
13
14 % cpanm -S POE::Component::SSLify
15
16 ## Installing with the CPAN shell
17
18 Alternatively, if your CPAN shell is set up, you should just be able to do:
19
20 % cpan POE::Component::SSLify
21
22 ## Manual installation
23
24 As a last resort, you can manually install it. Download the tarball, untar it,
25 then build it:
26
27 % perl Makefile.PL
28 % make && make test
29
30 Then install it:
31
32 % make install
33
34 If you are installing into a system-wide directory, you may need to run:
35
36 % sudo make install
37
38 ## Documentation
39
40 POE-Component-SSLify documentation is available as POD.
41 You can run perldoc from a shell to read the documentation:
42
43 % perldoc POE::Component::SSLify
0 This software is copyright (c) 2010 by Apocalypse <APOCAL@cpan.org>.
0 This software is copyright (c) 2011 by Apocalypse.
11
22 This is free software; you can redistribute it and/or modify it under
33 the same terms as the Perl 5 programming language system itself.
1111
1212 --- The GNU General Public License, Version 1, February 1989 ---
1313
14 This software is Copyright (c) 2010 by Apocalypse <APOCAL@cpan.org>.
14 This software is Copyright (c) 2011 by Apocalypse.
1515
1616 This is free software, licensed under:
1717
269269
270270 --- The Artistic License 1.0 ---
271271
272 This software is Copyright (c) 2010 by Apocalypse <APOCAL@cpan.org>.
272 This software is Copyright (c) 2011 by Apocalypse.
273273
274274 This is free software, licensed under:
275275
00 Build.PL
1 Changes
2 CommitLog
3 INSTALL
4 LICENSE
15 MANIFEST
26 MANIFEST.SKIP
7 META.json
8 META.yml
9 Makefile.PL
310 README
4 Makefile.PL
5 META.yml
6 Changes
7 LICENSE
8
11 SIGNATURE
12 dist.ini
13 examples/client.pl
14 examples/server.pl
15 examples/serverclient.pl
916 lib/POE/Component/SSLify.pm
1017 lib/POE/Component/SSLify/ClientHandle.pm
1118 lib/POE/Component/SSLify/ServerHandle.pm
12
13 examples/client.pl
14 examples/server.pl
15 examples/serverclient.pl
16
1719 mylib/example.crt
1820 mylib/example.key
19
20 t/1_load.t
21 t/2_simple.t
22 t/3_renegotiate.t
23 t/apocalypse.t
21 t/00-compile.t
22 t/000-report-versions-tiny.t
23 t/1_simple.t
24 t/2_renegotiate.t
25 t/3_insitu.t
0 # Added by Dist::Zilla::PluginBundle::Apocalyptic v0.001
1
02 # skip Eclipse IDE stuff
13 \.includepath$
24 \.project$
35 \.settings/
46
57 # Avoid version control files.
8 \bRCS\b
9 \bCVS\b
10 ,v$
611 \B\.svn\b
712 \B\.git\b
13 ^\.gitignore$
14
15 # Ignore Dist::Zilla's build dir
16 ^\.build/
17
18 # Avoid configuration metadata file
19 ^MYMETA\.
820
921 # Avoid Makemaker generated and utility files.
10 \bMakefile$
11 \bblib/
12 \bMakeMaker-\d
22 ^Makefile$
23 ^blib/
24 ^MakeMaker-\d
1325 \bpm_to_blib$
26 ^blibdirs$
1427
1528 # Avoid Module::Build generated and utility files.
1629 \bBuild$
17 \b_build/
18 ^MYMETA.yml$
30 \bBuild.bat$
31 \b_build
32 \bBuild.COM$
33 \bBUILD.COM$
34 \bbuild.com$
1935
2036 # Avoid temp and backup files.
2137 ~$
2238 \.old$
2339 \#$
24 \b\.#
40 ^\.#
2541 \.bak$
2642
2743 # our tarballs
2844 \.tar\.gz$
45 ^releases/
46
0 {
1 "abstract" : "Makes using SSL in the world of POE easy!",
2 "author" : [
3 "Apocalypse <APOCAL@cpan.org>"
4 ],
5 "dynamic_config" : 0,
6 "generated_by" : "Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.102400",
7 "license" : [
8 "perl_5"
9 ],
10 "meta-spec" : {
11 "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
12 "version" : "2"
13 },
14 "name" : "POE-Component-SSLify",
15 "no_index" : {
16 "directory" : [
17 "t",
18 "examples",
19 "mylib"
20 ]
21 },
22 "prereqs" : {
23 "build" : {
24 "requires" : {
25 "Module::Build" : "0.3601"
26 }
27 },
28 "configure" : {
29 "requires" : {
30 "Module::Build" : "0.3601"
31 }
32 },
33 "runtime" : {
34 "requires" : {
35 "Exporter" : 0,
36 "IO::Handle" : "1.28",
37 "Net::SSLeay" : 0,
38 "Symbol" : 0,
39 "perl" : "5.006",
40 "vars" : 0
41 }
42 },
43 "test" : {
44 "requires" : {
45 "File::Find" : 0,
46 "File::Temp" : 0,
47 "POE" : "1.267",
48 "POE::Component::Client::TCP" : 0,
49 "POE::Component::Server::TCP" : 0,
50 "Socket" : 0,
51 "Test::More" : "0.88"
52 }
53 }
54 },
55 "provides" : {
56 "POE::Component::SSLify" : {
57 "file" : "lib/POE/Component/SSLify.pm",
58 "version" : "1.002"
59 },
60 "POE::Component::SSLify::ClientHandle" : {
61 "file" : "lib/POE/Component/SSLify/ClientHandle.pm",
62 "version" : "1.002"
63 },
64 "POE::Component::SSLify::ServerHandle" : {
65 "file" : "lib/POE/Component/SSLify/ServerHandle.pm",
66 "version" : "1.002"
67 }
68 },
69 "release_status" : "stable",
70 "resources" : {
71 "bugtracker" : {
72 "mailto" : "bug-poe-component-sslify at rt.cpan.org",
73 "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=POE-Component-SSLify"
74 },
75 "homepage" : "http://search.cpan.org/dist/POE-Component-SSLify/",
76 "license" : [
77 "http://dev.perl.org/licenses/"
78 ],
79 "repository" : {
80 "type" : "git",
81 "url" : "git://github.com/apocalypse/perl-poe-sslify.git",
82 "web" : "http://github.com/apocalypse/perl-poe-sslify"
83 }
84 },
85 "version" : "1.002",
86 "x_BuiltWith" : {
87 "modules" : {
88 "Exporter" : "5.63",
89 "File::Find" : "1.12",
90 "File::Temp" : "0.22",
91 "IO::Handle" : "1.28",
92 "Module::Build" : "0.3607",
93 "Net::SSLeay" : "1.36",
94 "POE" : "1.299",
95 "POE::Component::Client::TCP" : "1.299",
96 "POE::Component::Server::TCP" : "1.299",
97 "Socket" : "1.80",
98 "Symbol" : "1.06",
99 "Test::More" : "0.96",
100 "perl" : "NA(skipped: perl)",
101 "vars" : "1.01"
102 },
103 "perl" : {
104 "original" : "v5.10.0",
105 "qv" : 1,
106 "version" : [
107 5,
108 10,
109 0
110 ]
111 },
112 "platform" : "linux",
113 "uname" : "Linux 2.6.31-22-generic x86_64"
114 },
115 "x_Dist_Zilla" : {
116 "plugins" : [
117 {
118 "class" : "Dist::Zilla::Plugin::Git::NextVersion",
119 "name" : "@Apocalyptic/Git::NextVersion",
120 "version" : "1.103470"
121 },
122 {
123 "class" : "Dist::Zilla::Plugin::GatherDir",
124 "name" : "@Apocalyptic/GatherDir",
125 "version" : "4.102345"
126 },
127 {
128 "class" : "Dist::Zilla::Plugin::PruneCruft",
129 "name" : "@Apocalyptic/PruneCruft",
130 "version" : "4.102345"
131 },
132 {
133 "class" : "Dist::Zilla::Plugin::AutoPrereqs",
134 "name" : "@Apocalyptic/AutoPrereqs",
135 "version" : "4.102345"
136 },
137 {
138 "class" : "Dist::Zilla::Plugin::GenerateFile",
139 "name" : "@Apocalyptic/MANIFEST.SKIP",
140 "version" : "4.102345"
141 },
142 {
143 "class" : "Dist::Zilla::Plugin::ManifestSkip",
144 "name" : "@Apocalyptic/ManifestSkip",
145 "version" : "4.102345"
146 },
147 {
148 "class" : "Dist::Zilla::Plugin::CompileTests",
149 "name" : "@Apocalyptic/CompileTests",
150 "version" : "1.103030"
151 },
152 {
153 "class" : "Dist::Zilla::Plugin::ReportVersions::Tiny",
154 "name" : "@Apocalyptic/ReportVersions::Tiny",
155 "version" : "1.02"
156 },
157 {
158 "class" : "Dist::Zilla::Plugin::Prepender",
159 "name" : "@Apocalyptic/Prepender",
160 "version" : "1.101590"
161 },
162 {
163 "class" : "Dist::Zilla::Plugin::Authority",
164 "name" : "@Apocalyptic/Authority",
165 "version" : "1.003"
166 },
167 {
168 "class" : "Dist::Zilla::Plugin::PkgVersion",
169 "name" : "@Apocalyptic/PkgVersion",
170 "version" : "4.102345"
171 },
172 {
173 "class" : "Dist::Zilla::Plugin::PodWeaver",
174 "name" : "@Apocalyptic/PodWeaver",
175 "version" : "3.101641"
176 },
177 {
178 "class" : "Dist::Zilla::Plugin::NextRelease",
179 "name" : "@Apocalyptic/NextRelease",
180 "version" : "4.102345"
181 },
182 {
183 "class" : "Dist::Zilla::Plugin::ChangelogFromGit",
184 "name" : "@Apocalyptic/ChangelogFromGit",
185 "version" : "0.002"
186 },
187 {
188 "class" : "Dist::Zilla::Plugin::MinimumPerl",
189 "name" : "@Apocalyptic/MinimumPerl",
190 "version" : "1.001"
191 },
192 {
193 "class" : "Dist::Zilla::Plugin::Bugtracker",
194 "name" : "@Apocalyptic/Bugtracker",
195 "version" : "1.102670"
196 },
197 {
198 "class" : "Dist::Zilla::Plugin::Homepage",
199 "name" : "@Apocalyptic/Homepage",
200 "version" : "1.101420"
201 },
202 {
203 "class" : "Dist::Zilla::Plugin::MetaConfig",
204 "name" : "@Apocalyptic/MetaConfig",
205 "version" : "4.102345"
206 },
207 {
208 "class" : "Dist::Zilla::Plugin::MetaData::BuiltWith",
209 "config" : {
210 "Dist::Zilla::Plugin::MetaData::BuiltWith" : {
211 "_stash_key" : "x_BuiltWith",
212 "show_uname" : 1,
213 "uname" : {
214 "uname_args" : [
215 "-s",
216 "-r",
217 "-m"
218 ],
219 "uname_call" : "uname"
220 }
221 }
222 },
223 "name" : "@Apocalyptic/MetaData::BuiltWith",
224 "version" : "0.01018204"
225 },
226 {
227 "class" : "Dist::Zilla::Plugin::Repository",
228 "name" : "@Apocalyptic/Repository",
229 "version" : "0.16"
230 },
231 {
232 "class" : "Dist::Zilla::Plugin::MetaResources",
233 "name" : "@Apocalyptic/MetaResources",
234 "version" : "4.102345"
235 },
236 {
237 "class" : "Dist::Zilla::Plugin::MetaNoIndex",
238 "name" : "@Apocalyptic/MetaNoIndex",
239 "version" : "1.101550"
240 },
241 {
242 "class" : "Dist::Zilla::Plugin::MetaProvides::Package",
243 "name" : "@Apocalyptic/MetaProvides::Package",
244 "version" : "1.12044908"
245 },
246 {
247 "class" : "Dist::Zilla::Plugin::License",
248 "name" : "@Apocalyptic/License",
249 "version" : "4.102345"
250 },
251 {
252 "class" : "Dist::Zilla::Plugin::MakeMaker",
253 "name" : "@Apocalyptic/MakeMaker",
254 "version" : "4.102345"
255 },
256 {
257 "class" : "Dist::Zilla::Plugin::ModuleBuild",
258 "name" : "@Apocalyptic/ModuleBuild",
259 "version" : "4.102345"
260 },
261 {
262 "class" : "Dist::Zilla::Plugin::DualBuilders",
263 "name" : "@Apocalyptic/DualBuilders",
264 "version" : "1.001"
265 },
266 {
267 "class" : "Dist::Zilla::Plugin::MetaYAML",
268 "name" : "@Apocalyptic/MetaYAML",
269 "version" : "4.102345"
270 },
271 {
272 "class" : "Dist::Zilla::Plugin::MetaJSON",
273 "name" : "@Apocalyptic/MetaJSON",
274 "version" : "4.102345"
275 },
276 {
277 "class" : "Dist::Zilla::Plugin::ReadmeFromPod",
278 "name" : "@Apocalyptic/ReadmeFromPod",
279 "version" : "0.14"
280 },
281 {
282 "class" : "Dist::Zilla::Plugin::InstallGuide",
283 "name" : "@Apocalyptic/InstallGuide",
284 "version" : "1.101461"
285 },
286 {
287 "class" : "Dist::Zilla::Plugin::Signature",
288 "name" : "@Apocalyptic/Signature",
289 "version" : "1.100930"
290 },
291 {
292 "class" : "Dist::Zilla::Plugin::Manifest",
293 "name" : "@Apocalyptic/Manifest",
294 "version" : "4.102345"
295 },
296 {
297 "class" : "Dist::Zilla::Plugin::CheckChangesHasContent",
298 "name" : "@Apocalyptic/CheckChangesHasContent",
299 "version" : "0.003"
300 },
301 {
302 "class" : "Dist::Zilla::Plugin::Git::Check",
303 "name" : "@Apocalyptic/Git::Check",
304 "version" : "1.103470"
305 },
306 {
307 "class" : "Dist::Zilla::Plugin::ConfirmRelease",
308 "name" : "@Apocalyptic/ConfirmRelease",
309 "version" : "4.102345"
310 },
311 {
312 "class" : "Dist::Zilla::Plugin::UploadToCPAN",
313 "name" : "@Apocalyptic/UploadToCPAN",
314 "version" : "4.102345"
315 },
316 {
317 "class" : "Dist::Zilla::Plugin::ArchiveRelease",
318 "name" : "@Apocalyptic/ArchiveRelease",
319 "version" : "3.01"
320 },
321 {
322 "class" : "Dist::Zilla::Plugin::Git::Commit",
323 "name" : "@Apocalyptic/Git::Commit",
324 "version" : "1.103470"
325 },
326 {
327 "class" : "Dist::Zilla::Plugin::Git::Tag",
328 "name" : "@Apocalyptic/Git::Tag",
329 "version" : "1.103470"
330 },
331 {
332 "class" : "Dist::Zilla::Plugin::Git::Push",
333 "name" : "@Apocalyptic/Git::Push",
334 "version" : "1.103470"
335 },
336 {
337 "class" : "Dist::Zilla::Plugin::FinderCode",
338 "name" : ":InstallModules",
339 "version" : "4.102345"
340 },
341 {
342 "class" : "Dist::Zilla::Plugin::FinderCode",
343 "name" : ":TestFiles",
344 "version" : "4.102345"
345 },
346 {
347 "class" : "Dist::Zilla::Plugin::FinderCode",
348 "name" : ":ExecFiles",
349 "version" : "4.102345"
350 },
351 {
352 "class" : "Dist::Zilla::Plugin::FinderCode",
353 "name" : ":ShareFiles",
354 "version" : "4.102345"
355 }
356 ],
357 "zilla" : {
358 "class" : "Dist::Zilla::Dist::Builder",
359 "config" : {
360 "is_trial" : 0
361 },
362 "version" : "4.102345"
363 }
364 },
365 "x_authority" : "cpan:APOCAL"
366 }
367
00 ---
1 abstract: 'SSL in the world of POE made easy'
1 abstract: 'Makes using SSL in the world of POE easy!'
22 author:
33 - 'Apocalypse <APOCAL@cpan.org>'
44 build_requires:
5 File::Find: 0
6 File::Temp: 0
7 Module::Build: 0.3601
58 POE: 1.267
69 POE::Component::Client::TCP: 0
710 POE::Component::Server::TCP: 0
11 Socket: 0
12 Test::More: 0.88
813 configure_requires:
9 Module::Build: 0.36
14 Module::Build: 0.3601
1015 dynamic_config: 0
11 generated_by: 'Module::Build version 0.3607'
16 generated_by: 'Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.102400'
1217 license: perl
1318 meta-spec:
1419 url: http://module-build.sourceforge.net/META-spec-v1.4.html
1520 version: 1.4
1621 name: POE-Component-SSLify
22 no_index:
23 directory:
24 - t
25 - examples
26 - mylib
1727 provides:
1828 POE::Component::SSLify:
1929 file: lib/POE/Component/SSLify.pm
20 version: 0.20
30 version: 1.002
2131 POE::Component::SSLify::ClientHandle:
2232 file: lib/POE/Component/SSLify/ClientHandle.pm
23 version: 0.20
33 version: 1.002
2434 POE::Component::SSLify::ServerHandle:
2535 file: lib/POE/Component/SSLify/ServerHandle.pm
26 version: 0.20
36 version: 1.002
2737 requires:
28 Net::SSLeay: 1.36
38 Exporter: 0
39 IO::Handle: 1.28
40 Net::SSLeay: 0
41 Symbol: 0
2942 perl: 5.006
43 vars: 0
3044 resources:
31 bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify
32 homepage: http://search.cpan.org/dist/POE-Component-SSLify
45 bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=POE-Component-SSLify
46 homepage: http://search.cpan.org/dist/POE-Component-SSLify/
3347 license: http://dev.perl.org/licenses/
34 repository: http://github.com/apocalypse/perl-poe-sslify
35 version: 0.20
48 repository: git://github.com/apocalypse/perl-poe-sslify.git
49 version: 1.002
50 x_BuiltWith:
51 modules:
52 Exporter: 5.63
53 File::Find: 1.12
54 File::Temp: 0.22
55 IO::Handle: 1.28
56 Module::Build: 0.3607
57 Net::SSLeay: 1.36
58 POE: 1.299
59 POE::Component::Client::TCP: 1.299
60 POE::Component::Server::TCP: 1.299
61 Socket: 1.80
62 Symbol: 1.06
63 Test::More: 0.96
64 perl: 'NA(skipped: perl)'
65 vars: 1.01
66 perl:
67 original: v5.10.0
68 qv: 1
69 version:
70 - 5
71 - 10
72 - 0
73 platform: linux
74 uname: 'Linux 2.6.31-22-generic x86_64'
75 x_Dist_Zilla:
76 plugins:
77 -
78 class: Dist::Zilla::Plugin::Git::NextVersion
79 name: '@Apocalyptic/Git::NextVersion'
80 version: 1.103470
81 -
82 class: Dist::Zilla::Plugin::GatherDir
83 name: '@Apocalyptic/GatherDir'
84 version: 4.102345
85 -
86 class: Dist::Zilla::Plugin::PruneCruft
87 name: '@Apocalyptic/PruneCruft'
88 version: 4.102345
89 -
90 class: Dist::Zilla::Plugin::AutoPrereqs
91 name: '@Apocalyptic/AutoPrereqs'
92 version: 4.102345
93 -
94 class: Dist::Zilla::Plugin::GenerateFile
95 name: '@Apocalyptic/MANIFEST.SKIP'
96 version: 4.102345
97 -
98 class: Dist::Zilla::Plugin::ManifestSkip
99 name: '@Apocalyptic/ManifestSkip'
100 version: 4.102345
101 -
102 class: Dist::Zilla::Plugin::CompileTests
103 name: '@Apocalyptic/CompileTests'
104 version: 1.103030
105 -
106 class: Dist::Zilla::Plugin::ReportVersions::Tiny
107 name: '@Apocalyptic/ReportVersions::Tiny'
108 version: 1.02
109 -
110 class: Dist::Zilla::Plugin::Prepender
111 name: '@Apocalyptic/Prepender'
112 version: 1.101590
113 -
114 class: Dist::Zilla::Plugin::Authority
115 name: '@Apocalyptic/Authority'
116 version: 1.003
117 -
118 class: Dist::Zilla::Plugin::PkgVersion
119 name: '@Apocalyptic/PkgVersion'
120 version: 4.102345
121 -
122 class: Dist::Zilla::Plugin::PodWeaver
123 name: '@Apocalyptic/PodWeaver'
124 version: 3.101641
125 -
126 class: Dist::Zilla::Plugin::NextRelease
127 name: '@Apocalyptic/NextRelease'
128 version: 4.102345
129 -
130 class: Dist::Zilla::Plugin::ChangelogFromGit
131 name: '@Apocalyptic/ChangelogFromGit'
132 version: 0.002
133 -
134 class: Dist::Zilla::Plugin::MinimumPerl
135 name: '@Apocalyptic/MinimumPerl'
136 version: 1.001
137 -
138 class: Dist::Zilla::Plugin::Bugtracker
139 name: '@Apocalyptic/Bugtracker'
140 version: 1.102670
141 -
142 class: Dist::Zilla::Plugin::Homepage
143 name: '@Apocalyptic/Homepage'
144 version: 1.101420
145 -
146 class: Dist::Zilla::Plugin::MetaConfig
147 name: '@Apocalyptic/MetaConfig'
148 version: 4.102345
149 -
150 class: Dist::Zilla::Plugin::MetaData::BuiltWith
151 config:
152 Dist::Zilla::Plugin::MetaData::BuiltWith:
153 _stash_key: x_BuiltWith
154 show_uname: 1
155 uname:
156 uname_args:
157 - '-s'
158 - '-r'
159 - '-m'
160 uname_call: uname
161 name: '@Apocalyptic/MetaData::BuiltWith'
162 version: 0.01018204
163 -
164 class: Dist::Zilla::Plugin::Repository
165 name: '@Apocalyptic/Repository'
166 version: 0.16
167 -
168 class: Dist::Zilla::Plugin::MetaResources
169 name: '@Apocalyptic/MetaResources'
170 version: 4.102345
171 -
172 class: Dist::Zilla::Plugin::MetaNoIndex
173 name: '@Apocalyptic/MetaNoIndex'
174 version: 1.101550
175 -
176 class: Dist::Zilla::Plugin::MetaProvides::Package
177 name: '@Apocalyptic/MetaProvides::Package'
178 version: 1.12044908
179 -
180 class: Dist::Zilla::Plugin::License
181 name: '@Apocalyptic/License'
182 version: 4.102345
183 -
184 class: Dist::Zilla::Plugin::MakeMaker
185 name: '@Apocalyptic/MakeMaker'
186 version: 4.102345
187 -
188 class: Dist::Zilla::Plugin::ModuleBuild
189 name: '@Apocalyptic/ModuleBuild'
190 version: 4.102345
191 -
192 class: Dist::Zilla::Plugin::DualBuilders
193 name: '@Apocalyptic/DualBuilders'
194 version: 1.001
195 -
196 class: Dist::Zilla::Plugin::MetaYAML
197 name: '@Apocalyptic/MetaYAML'
198 version: 4.102345
199 -
200 class: Dist::Zilla::Plugin::MetaJSON
201 name: '@Apocalyptic/MetaJSON'
202 version: 4.102345
203 -
204 class: Dist::Zilla::Plugin::ReadmeFromPod
205 name: '@Apocalyptic/ReadmeFromPod'
206 version: 0.14
207 -
208 class: Dist::Zilla::Plugin::InstallGuide
209 name: '@Apocalyptic/InstallGuide'
210 version: 1.101461
211 -
212 class: Dist::Zilla::Plugin::Signature
213 name: '@Apocalyptic/Signature'
214 version: 1.100930
215 -
216 class: Dist::Zilla::Plugin::Manifest
217 name: '@Apocalyptic/Manifest'
218 version: 4.102345
219 -
220 class: Dist::Zilla::Plugin::CheckChangesHasContent
221 name: '@Apocalyptic/CheckChangesHasContent'
222 version: 0.003
223 -
224 class: Dist::Zilla::Plugin::Git::Check
225 name: '@Apocalyptic/Git::Check'
226 version: 1.103470
227 -
228 class: Dist::Zilla::Plugin::ConfirmRelease
229 name: '@Apocalyptic/ConfirmRelease'
230 version: 4.102345
231 -
232 class: Dist::Zilla::Plugin::UploadToCPAN
233 name: '@Apocalyptic/UploadToCPAN'
234 version: 4.102345
235 -
236 class: Dist::Zilla::Plugin::ArchiveRelease
237 name: '@Apocalyptic/ArchiveRelease'
238 version: 3.01
239 -
240 class: Dist::Zilla::Plugin::Git::Commit
241 name: '@Apocalyptic/Git::Commit'
242 version: 1.103470
243 -
244 class: Dist::Zilla::Plugin::Git::Tag
245 name: '@Apocalyptic/Git::Tag'
246 version: 1.103470
247 -
248 class: Dist::Zilla::Plugin::Git::Push
249 name: '@Apocalyptic/Git::Push'
250 version: 1.103470
251 -
252 class: Dist::Zilla::Plugin::FinderCode
253 name: ':InstallModules'
254 version: 4.102345
255 -
256 class: Dist::Zilla::Plugin::FinderCode
257 name: ':TestFiles'
258 version: 4.102345
259 -
260 class: Dist::Zilla::Plugin::FinderCode
261 name: ':ExecFiles'
262 version: 4.102345
263 -
264 class: Dist::Zilla::Plugin::FinderCode
265 name: ':ShareFiles'
266 version: 4.102345
267 zilla:
268 class: Dist::Zilla::Dist::Builder
269 config:
270 is_trial: 0
271 version: 4.102345
272 x_authority: cpan:APOCAL
0 # Note: this file was auto-generated by Module::Build::Compat version 0.3607
1 require 5.006;
2 use ExtUtils::MakeMaker;
3 WriteMakefile
4 (
5 'NAME' => 'POE::Component::SSLify',
6 'VERSION_FROM' => 'lib/POE/Component/SSLify.pm',
7 'PREREQ_PM' => {
8 'Net::SSLeay' => '1.36',
9 'POE' => '1.267',
10 'POE::Component::Client::TCP' => 0,
11 'POE::Component::Server::TCP' => 0
12 },
13 'INSTALLDIRS' => 'site',
14 'EXE_FILES' => [],
15 'PL_FILES' => {}
16 )
17 ;
0
1 use strict;
2 use warnings;
3
4 BEGIN { require 5.006; }
5
6 use ExtUtils::MakeMaker 6.31;
7
8
9
10 my %WriteMakefileArgs = (
11 'ABSTRACT' => 'Makes using SSL in the world of POE easy!',
12 'AUTHOR' => 'Apocalypse <APOCAL@cpan.org>',
13 'BUILD_REQUIRES' => {
14 'File::Find' => '0',
15 'File::Temp' => '0',
16 'ExtUtils::MakeMaker' => '6.31',
17 'POE' => '1.267',
18 'POE::Component::Client::TCP' => '0',
19 'POE::Component::Server::TCP' => '0',
20 'Socket' => '0',
21 'Test::More' => '0.88'
22 },
23 'CONFIGURE_REQUIRES' => {
24 'ExtUtils::MakeMaker' => '6.31'
25 },
26 'DISTNAME' => 'POE-Component-SSLify',
27 'EXE_FILES' => [],
28 'LICENSE' => 'perl',
29 'NAME' => 'POE::Component::SSLify',
30 'PREREQ_PM' => {
31 'Exporter' => '0',
32 'IO::Handle' => '1.28',
33 'Net::SSLeay' => '0',
34 'Symbol' => '0',
35 'vars' => '0'
36 },
37 'VERSION' => '1.002',
38 'test' => {
39 'TESTS' => 't/*.t'
40 }
41 );
42
43
44 unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
45 my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
46 my $pp = $WriteMakefileArgs{PREREQ_PM};
47 for my $mod ( keys %$br ) {
48 if ( exists $pp->{$mod} ) {
49 $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
50 }
51 else {
52 $pp->{$mod} = $br->{$mod};
53 }
54 }
55 }
56
57 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
58 unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
59
60 WriteMakefile(%WriteMakefileArgs);
61
62
63
+158
-114
README less more
00 NAME
11 POE::Component::SSLify - Makes using SSL in the world of POE easy!
22
3 VERSION
4 This document describes v1.002 of POE::Component::SSLify - released February 19, 2011 as part of POE-Component-SSLify.
5
36 SYNOPSIS
47 # CLIENT-side usage
58
69 # Import the module
710 use POE::Component::SSLify qw( Client_SSLify );
811
9 # Create a normal SocketFactory wheel or something
12 # Create a normal SocketFactory wheel and connect to a SSL-enabled server
1013 my $factory = POE::Wheel::SocketFactory->new;
1114
1215 # Time passes, SocketFactory gives you a socket when it connects in SuccessEvent
13 # Converts the socket into a SSL socket POE can communicate with
16 # Convert the socket into a SSL socket POE can communicate with
1417 my $socket = shift;
1518 eval { $socket = Client_SSLify( $socket ) };
1619 if ( $@ ) {
2326 # other options as usual
2427 );
2528
26 # Use it as you wish...
27 # End of example
28
2929 # --------------------------------------------------------------------------- #
3030
3131 # SERVER-side usage
3232
33 # !!! Make sure you have a public key + certificate generated via Net::SSLeay's makecert.pl
33 # !!! Make sure you have a public key + certificate
3434 # excellent howto: http://www.akadia.com/services/ssh_test_certificate.html
3535
3636 # Import the module
4242 # Unable to load key or certificate file...
4343 }
4444
45 # Create a normal SocketFactory wheel or something
45 # Create a normal SocketFactory wheel to listen for connections
4646 my $factory = POE::Wheel::SocketFactory->new;
4747
4848 # Time passes, SocketFactory gives you a socket when it gets a connection in SuccessEvent
49 # Converts the socket into a SSL socket POE can communicate with
49 # Convert the socket into a SSL socket POE can communicate with
5050 my $socket = shift;
5151 eval { $socket = Server_SSLify( $socket ) };
5252 if ( $@ ) {
5959 # other options as usual
6060 );
6161
62 # Use it as you wish...
63 # End of example
64
65 ABSTRACT
66 Makes SSL use in POE a breeze!
67
6862 DESCRIPTION
6963 This component represents the standard way to do SSL in POE.
70
71 NOTES
72 Socket methods doesn't work
73 The new socket this module gives you actually is some tied socket magic,
74 so you cannot do stuff like getpeername() or getsockname(). The only way
75 to do it is to use SSLify_GetSocket and then operate on the socket it
76 returns.
77
78 Dying everywhere...
79 This module will die() if Net::SSLeay could not be loaded or it is not
80 the version we want. So, it is recommended that you check for errors and
81 not use SSL, like so:
82
83 eval { use POE::Component::SSLify };
84 if ( $@ ) {
85 $sslavailable = 0;
86 } else {
87 $sslavailable = 1;
88 }
89
90 # Make socket SSL!
91 if ( $sslavailable ) {
92 eval { $socket = POE::Component::SSLify::Client_SSLify( $socket ) };
93 if ( $@ ) {
94 # Unable to SSLify the socket...
95 }
96 }
97
98 OpenSSL functions
99 Theoretically you can do anything that Net::SSLeay exports from the
100 OpenSSL libs on the socket. However, I have not tested every possible
101 function against SSLify, so use them carefully! If you have success,
102 please report back to me so I can update this doc!
103
104 Net::SSLeay::renegotiate
105 This function has been tested ( it's in t/3_renegotiate.t ) but it
106 doesn't work on FreeBSD! I tracked it down to this security advisory:
107 <http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc> which
108 explains it in detail. The test will skip this function if it detects
109 that you're on a broken system. However, if you have the updated OpenSSL
110 library that fixes this you can use it.
11164
11265 FUNCTIONS
11366 Client_SSLify
149102 Furthermore, you can pass in your own $ctx object if you desire. This allows you to set custom parameters
150103 per-connection, for example.
151104 my $socket = shift; # get the socket from somewhere
152 my $ctx = Net::SSLeay::CTX_new();
105 my $ctx = SSLify_ContextCreate();
153106 # set various options on $ctx as desired
154107 $socket = Server_SSLify( $socket, $ctx );
155108
156109 NOTE: You can use SSLify_GetCTX to modify the global, and avoid doing this on every connection if the
157110 options are the same...
158111
159 SSLify_Options
160 Accepts the location of the SSL key + certificate files and does it's job
161
162 Optionally accepts the SSL version + CTX options
163 SSLify_Options( $key, $cert, $version, $options );
164
165 Known versions:
112 SSLify_ContextCreate
113 Accepts some options, and returns a brand-new Net::SSLeay context object ( $ctx )
114 my $ctx = SSLify_ContextCreate( $key, $cert, $version, $options );
115
116 You can then call various Net::SSLeay methods on the context
117 my $mode = Net::SSLeay::CTX_get_mode( $ctx );
118
119 By default we don't use the SSL key + certificate files
120
121 By default we use the version: default
122
123 Known versions:
166124 * sslv2
167125 * sslv3
168126 * tlsv1
169127 * default
170128
129 By default we don't set any options
130
131 SSLify_Options
132 Call this function to initialize the global server-side CTX. Accepts the location of the
133 SSL key + certificate files, which is required.
134
135 Optionally accepts the SSL version + CTX options
136 SSLify_Options( $key, $cert, $version, $options );
137
171138 By default we use the version: default
172139
140 Known versions:
141 * sslv2
142 * sslv3
143 * tlsv1
144 * default
145
173146 By default we use the options: &Net::SSLeay::OP_ALL
174147
175148 SSLify_GetCTX
176 Returns the server-side CTX in case you wanted to play around with it :)
149 Returns the actual Net::SSLeay context object in case you wanted to play with it :)
177150
178151 If passed in a socket, it will return that socket's $ctx instead of the global.
179152 my $ctx = SSLify_GetCTX(); # get the one set via SSLify_Options
205178 Example:
206179 print "Remote IP is: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $sslified_sock ) ) ) )[1] ) . "\n";
207180
208 SSLify_ContextCreate
209 Accepts some options, and returns a brand-new SSL context object ( $ctx )
210 my $ctx = SSLify_ContextCreate();
211 my $ctx = SSLify_ContextCreate( $key, $cert );
212 my $ctx = SSLify_ContextCreate( $key, $cert, $version, $options );
213
214 Known versions:
215 * sslv2
216 * sslv3
217 * tlsv1
218 * default
219
220 By default we use the version: default
221
222 By default we don't set any options
223
224 By default we don't use the SSL key + certificate files
181 SSLify_GetSSL
182 Returns the actual Net::SSLeay object so you can call methods on it
183
184 Example:
185 print Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $sslified_sock ) );
186
187 NOTES
188 Socket methods doesn't work
189 The new socket this module gives you actually is some tied socket magic,
190 so you cannot do stuff like getpeername() or getsockname(). The only way
191 to do it is to use SSLify_GetSocket and then operate on the socket it
192 returns.
193
194 Dying everywhere...
195 This module will die() if Net::SSLeay could not be loaded or it is not
196 the version we want. So, it is recommended that you check for errors and
197 not use SSL, like so:
198
199 eval { use POE::Component::SSLify };
200 if ( $@ ) {
201 $sslavailable = 0;
202 } else {
203 $sslavailable = 1;
204 }
205
206 # Make socket SSL!
207 if ( $sslavailable ) {
208 eval { $socket = POE::Component::SSLify::Client_SSLify( $socket ) };
209 if ( $@ ) {
210 # Unable to SSLify the socket...
211 }
212 }
213
214 OpenSSL functions
215 Theoretically you can do anything that Net::SSLeay exports from the
216 OpenSSL libs on the socket. However, I have not tested every possible
217 function against SSLify, so use them carefully!
218
219 Net::SSLeay::renegotiate
220 This function has been tested ( it's in "t/2_renegotiate.t" ) but it
221 doesn't work on FreeBSD! I tracked it down to this security advisory:
222 <http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc> which
223 explains it in detail. The test will skip this function if it detects
224 that you're on a broken system. However, if you have the updated OpenSSL
225 library that fixes this you can use it.
226
227 In-Situ sslification
228 You can have a normal plaintext socket, and convert it to SSL anytime.
229 Just keep in mind that the client and the server must agree to sslify at
230 the same time, or they will be waiting on each other forever! See
231 "t/3_insitu.t" for an example of how this works.
225232
226233 EXPORT
227234 Stuffs all of the above functions in @EXPORT_OK so you have to request them directly
228235
236 SEE ALSO
237 Please see those modules/websites for more information related to this
238 module.
239
240 * POE
241
242 * Net::SSLeay
243
229244 SUPPORT
245 Perldoc
230246 You can find documentation for this module with the perldoc command.
231247
232 perldoc POE::Component::SSLify
248 perldoc POE::Component::SSLify
233249
234250 Websites
251 The following websites have more information about this module, and may
252 be of help to you. As always, in addition to those websites please use
253 your favorite search engine to discover more resources.
254
235255 * Search CPAN
236256
237257 <http://search.cpan.org/dist/POE-Component-SSLify>
238258
259 * RT: CPAN's Bug Tracker
260
261 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify>
262
239263 * AnnoCPAN: Annotated CPAN documentation
240264
241265 <http://annocpan.org/dist/POE-Component-SSLify>
248272
249273 <http://cpanforum.com/dist/POE-Component-SSLify>
250274
251 * RT: CPAN's Request Tracker
252
253 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify>
254
255275 * CPANTS Kwalitee
256276
257277 <http://cpants.perl.org/dist/overview/POE-Component-SSLify>
264284
265285 <http://matrix.cpantesters.org/?dist=POE-Component-SSLify>
266286
267 * Git Source Code Repository
268
269 This code is currently hosted on github.com under the account
270 "apocalypse". Please feel free to browse it and pull from it, or
271 whatever. If you want to contribute patches, please send me a diff
272 or prod me to pull from your repository :)
273
274 <http://github.com/apocalypse/perl-poe-sslify>
275
276 Bugs
277 Please report any bugs or feature requests to "bug-poe-component-sslify
278 at rt.cpan.org", or through the web interface at
279 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-SSLify>. I
280 will be notified, and then you'll automatically be notified of progress
281 on your bug as I make changes.
282
283 SEE ALSO
284 POE
285
286 Net::SSLeay
287 Email
288 You can email the author of this module at "APOCAL at cpan.org" asking
289 for help with any problems you have.
290
291 Internet Relay Chat
292 You can get live help by using IRC ( Internet Relay Chat ). If you don't
293 know what IRC is, please read this excellent guide:
294 <http://en.wikipedia.org/wiki/Internet_Relay_Chat>. Please be courteous
295 and patient when talking to us, as we might be busy or sleeping! You can
296 join those networks/channels and get help:
297
298 * irc.perl.org
299
300 You can connect to the server at 'irc.perl.org' and join this
301 channel: #perl-help then talk to this person for help: Apocalypse.
302
303 * irc.freenode.net
304
305 You can connect to the server at 'irc.freenode.net' and join this
306 channel: #perl then talk to this person for help: Apocal.
307
308 * irc.efnet.org
309
310 You can connect to the server at 'irc.efnet.org' and join this
311 channel: #perl then talk to this person for help: Ap0cal.
312
313 Bugs / Feature Requests
314 Please report any bugs or feature requests by email to
315 "bug-poe-component-sslify at rt.cpan.org", or through the web interface
316 at
317 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-SSLify>.
318 You will be automatically notified of any progress on the request by the
319 system.
320
321 Source Code
322 The code is open to the world, and available for you to hack on. Please
323 feel free to browse it and play with it, or whatever. If you want to
324 contribute patches, please send me a diff or prod me to pull from your
325 repository :)
326
327 <http://github.com/apocalypse/perl-poe-sslify>
328
329 git clone git://github.com/apocalypse/perl-poe-sslify.git
287330
288331 AUTHOR
289 Apocalypse <apocal@cpan.org>
290
332 Apocalypse <APOCAL@cpan.org>
333
334 ACKNOWLEDGEMENTS
291335 Original code is entirely Rocco Caputo ( Creator of POE ) -> I simply
292336 packaged up the code into something everyone could use and accepted the burden
293337 of maintaining it :)
301345 work this module would still be stuck in the stone age :)
302346
303347 COPYRIGHT AND LICENSE
304 Copyright 2010 by Apocalypse/Rocco Caputo/Dariusz Jackowski
305
306 This library is free software; you can redistribute it and/or modify it
307 under the same terms as Perl itself.
348 This software is copyright (c) 2011 by Apocalypse.
349
350 This is free software; you can redistribute it and/or modify it under
351 the same terms as the Perl 5 programming language system itself.
308352
309353 The full text of the license can be found in the LICENSE file included
310 with this module.
311
354 with this distribution.
355
0 This file contains message digests of all files listed in MANIFEST,
1 signed via the Module::Signature module, version 0.66.
2
3 To verify the content in this distribution, first make sure you have
4 Module::Signature installed, then type:
5
6 % cpansign -v
7
8 It will check each file's integrity, as well as the signature's
9 validity. If "==> Signature verified OK! <==" is not displayed,
10 the distribution may already have been compromised, and you should
11 not run its Makefile.PL or Build.PL.
12
13 -----BEGIN PGP SIGNED MESSAGE-----
14 Hash: SHA1
15
16 SHA1 824ac753cab91f2771cc02d2ef2ea3adcb553b3d Build.PL
17 SHA1 077d1b83cbdd3c5868246267d529f6ba86c9f5ae Changes
18 SHA1 bccfcc0e06e54b64690760210bffb659fc37d8a3 CommitLog
19 SHA1 e3edc44697d1770c65fec99f6ebdb6ea55fb3050 INSTALL
20 SHA1 263360e99a0de4d587fedefe1a919dcf61af1d10 LICENSE
21 SHA1 9b47f2f0b927dcb7cab2cc1f7daa62c5b50c55f8 MANIFEST
22 SHA1 9dfc07c5655b958e800189837f3ddd37ca050bfe MANIFEST.SKIP
23 SHA1 46a26e693e358bfaae14207085afe55ba6eaf361 META.json
24 SHA1 c365eb8b83298415d1943bdab6d34d73857572d2 META.yml
25 SHA1 b6349b4bc00f32576a8824dc472b2ccc2090d121 Makefile.PL
26 SHA1 f35f0e1a391125f6e2d8db296430007ab257a6dc README
27 SHA1 41a5da1356107d097f6bbf72c62ee4da83e4119f dist.ini
28 SHA1 96decb1c51052f9b024b6d069e428b4ccc19e909 examples/client.pl
29 SHA1 d8f9b44df461cdcf6cbd7cffd79a9d49aade3947 examples/server.pl
30 SHA1 c4a936c75d1d566e936dfb1776c9a01ea244c618 examples/serverclient.pl
31 SHA1 443d26c5a8beaaa9645707f05103bc05143a1531 lib/POE/Component/SSLify.pm
32 SHA1 b8e2f2b009899b565d7e654318620a69c14c52e0 lib/POE/Component/SSLify/ClientHandle.pm
33 SHA1 963fb5f3d99a99218836cac8c246735ef4ef66b0 lib/POE/Component/SSLify/ServerHandle.pm
34 SHA1 59afa28f138a14b956443f915d60a891d5b306b8 mylib/example.crt
35 SHA1 f2ba02d28cfb207e0a86be7cb4f3c570f257bf93 mylib/example.key
36 SHA1 fd48b12e3df15fb55695e7d1b4ee95dc3c0cd766 t/00-compile.t
37 SHA1 17448d647ba0e9c5c6785b7f8d7757c3e19e1e47 t/000-report-versions-tiny.t
38 SHA1 a0fb19347ec360acca7bb08e1b2e437179ef3cfa t/1_simple.t
39 SHA1 c625a70ac63ea5d6a0fabd07130f1d3a905b1933 t/2_renegotiate.t
40 SHA1 034a72d7403a58a756c8cbd2b1ce15afd9acf333 t/3_insitu.t
41 -----BEGIN PGP SIGNATURE-----
42 Version: GnuPG v1.4.9 (GNU/Linux)
43
44 iEYEARECAAYFAk1gl10ACgkQGfr7vsGKgxwytACeNcYDu9CjrhwX+PHHvxsh90tB
45 xlMAn3NNRBe0mWb5DqISPlLucrQBl9+D
46 =Xtye
47 -----END PGP SIGNATURE-----
0 libpoe-component-sslify-perl (1.002-1) UNRELEASED; urgency=low
1
2 * New upstream release
3 * Refresh copyright information
4 * Bump package to debhelper 8
5 * Add myself to Uploaders and Copyright
6 * Slight rewrite of control description
7
8 -- Jonathan Yu <jawnsy@cpan.org> Sat, 26 Feb 2011 15:11:18 -0500
9
010 libpoe-component-sslify-perl (0.20-1) unstable; urgency=low
111
212 [ Jonathan Yu ]
00 Source: libpoe-component-sslify-perl
11 Section: perl
22 Priority: optional
3 Build-Depends: debhelper (>= 8)
4 Build-Depends-Indep: perl, netbase,
5 libnet-ssleay-perl (>= 1.36),
6 libpoe-perl (>= 2:1.267),
7 libtest-nowarnings-perl
38 Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
49 Uploaders: Niko Tyni <ntyni@debian.org>, Martín Ferrari <tincho@debian.org>,
510 Jose Luis Rivas <ghostbar38@gmail.com>, Damyan Ivanov <dmn@debian.org>,
11 Jonathan Yu <jawnsy@cpan.org>,
612 gregor herrmann <gregoa@debian.org>
7 Build-Depends: debhelper (>= 7)
8 Build-Depends-Indep: perl, libnet-ssleay-perl (>= 1.36),
9 libpoe-perl (>= 2:1.267), libtest-nowarnings-perl, netbase
10 Standards-Version: 3.8.4
13 Standards-Version: 3.9.1
1114 Homepage: http://search.cpan.org/dist/POE-Component-SSLify/
1215 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libpoe-component-sslify-perl/
1316 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libpoe-component-sslify-perl/
1417
1518 Package: libpoe-component-sslify-perl
1619 Architecture: all
17 Depends: ${perl:Depends}, ${misc:Depends}, libnet-ssleay-perl (>= 1.36)
18 Description: SSL connection handling module for other POE components
19 POE::Component::SSLify represents the standard way to handle SSL connections
20 for other POE Components. It allows for the creation of SSL-wrapped sockets,
21 generally used with POE::Wheel::SocketFactory, which are correctly handled by
22 the POE engine.
20 Depends: ${perl:Depends}, ${misc:Depends},
21 libnet-ssleay-perl (>= 1.36)
22 Description: module for SSL connection handling in POE Components
23 POE::Component::SSLify is a POE Component that represents the standard way to
24 handle SSL connections for other POE Components. It allows for the creation of
25 SSL-wrapped sockets, generally used with POE::Wheel::SocketFactory, which are
26 correctly handled by the POE engine.
00 Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
1 Maintainer: Apocalypse <APOCAL@cpan.org>
1 Maintainer: Apocalypse <apocal@cpan.org>
22 Source: http://search.cpan.org/dist/POE-Component-SSLify/
33 Name: POE-Component-SSLify
44
55 Files: *
6 Copyright: 2010, Apocalypse <APOCAL@cpan.org>
6 Copyright: 2011, Apocalypse <apocal@cpan.org>
77 2010, Rocco Caputo
88 2010, Dariusz Jackowski
99 License: Artistic or GPL-1+
1212 Copyright: 2007, Kees Cook <kees@outflux.net>
1313 2007, Niko Tyni <ntyni@debian.org>
1414 2008, Damyan Ivanov <dmn@debian.org>
15 2007, 2008, Martín Ferrari <tincho@debian.org>
16 2009, 2010, gregor herrmann <gregoa@debian.org>
15 2007-2008, Martín Ferrari <tincho@debian.org>
16 2009-2010, gregor herrmann <gregoa@debian.org>
17 2011, Jonathan Yu <jawnsy@cpan.org>
1718 License: Artistic or GPL-1+
1819
1920 License: Artistic
2021 This program is free software; you can redistribute it and/or modify
2122 it under the terms of the Artistic License, which comes with Perl.
2223 .
23 On Debian GNU/Linux systems, the complete text of the Artistic License
24 can be found in `/usr/share/common-licenses/Artistic'
24 On Debian systems, the complete text of the Artistic License can be
25 found in `/usr/share/common-licenses/Artistic'
2526
2627 License: GPL-1+
2728 This program is free software; you can redistribute it and/or modify
2930 the Free Software Foundation; either version 1, or (at your option)
3031 any later version.
3132 .
32 On Debian GNU/Linux systems, the complete text of the GNU General
33 Public License can be found in `/usr/share/common-licenses/GPL'
33 On Debian systems, the complete text of version 1 of the GNU General
34 Public License can be found in `/usr/share/common-licenses/GPL-1'
0 name = POE-Component-SSLify
1 [@Apocalyptic]
00 #!/usr/bin/perl
1 #
2 # This file is part of POE-Component-SSLify
3 #
4 # This software is copyright (c) 2011 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
19 use strict; use warnings;
210
311 use POE;
00 #!/usr/bin/perl
1 #
2 # This file is part of POE-Component-SSLify
3 #
4 # This software is copyright (c) 2011 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
19 use strict; use warnings;
210
311 use POE;
00 #!/usr/bin/perl
1 #
2 # This file is part of POE-Component-SSLify
3 #
4 # This software is copyright (c) 2011 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
19 use strict; use warnings;
210
311 use POE;
0 #
1 # This file is part of POE-Component-SSLify
2 #
3 # This software is copyright (c) 2011 by Apocalypse.
4 #
5 # This is free software; you can redistribute it and/or modify it under
6 # the same terms as the Perl 5 programming language system itself.
7 #
8 use strict; use warnings;
09 package POE::Component::SSLify::ClientHandle;
1 use strict; use warnings;
10 BEGIN {
11 $POE::Component::SSLify::ClientHandle::VERSION = '1.002';
12 }
13 BEGIN {
14 $POE::Component::SSLify::ClientHandle::AUTHORITY = 'cpan:APOCAL';
15 }
216
3 # Initialize our version
4 use vars qw( $VERSION );
5 $VERSION = '0.20';
17 # ABSTRACT: Client-side handle for SSLify
618
719 # Import the SSL death routines
820 use Net::SSLeay qw( die_now die_if_ssl_error );
4456 return $self;
4557 }
4658
47 # End of module
4859 1;
4960
61
5062 __END__
63 =pod
5164
5265 =head1 NAME
5366
54 POE::Component::SSLify::ClientHandle - client object for POE::Component::SSLify
67 POE::Component::SSLify::ClientHandle - Client-side handle for SSLify
5568
56 =head1 ABSTRACT
69 =head1 VERSION
5770
58 See POE::Component::SSLify::ServerHandle
71 This document describes v1.002 of POE::Component::SSLify::ClientHandle - released February 19, 2011 as part of POE-Component-SSLify.
5972
6073 =head1 DESCRIPTION
6174
6376
6477 =head1 SEE ALSO
6578
79 Please see those modules/websites for more information related to this module.
80
81 =over 4
82
83 =item *
84
6685 L<POE::Component::SSLify>
86
87 =item *
6788
6889 L<POE::Component::SSLify::ServerHandle>
6990
91 =back
92
7093 =head1 AUTHOR
7194
72 Apocalypse E<lt>apocal@cpan.orgE<gt>
95 Apocalypse <APOCAL@cpan.org>
7396
7497 =head1 COPYRIGHT AND LICENSE
7598
76 Copyright 2010 by Apocalypse
99 This software is copyright (c) 2011 by Apocalypse.
77100
78 This library is free software; you can redistribute it and/or modify
79 it under the same terms as Perl itself.
101 This is free software; you can redistribute it and/or modify it under
102 the same terms as the Perl 5 programming language system itself.
103
104 The full text of the license can be found in the LICENSE file included with this distribution.
80105
81106 =cut
107
0 #
1 # This file is part of POE-Component-SSLify
2 #
3 # This software is copyright (c) 2011 by Apocalypse.
4 #
5 # This is free software; you can redistribute it and/or modify it under
6 # the same terms as the Perl 5 programming language system itself.
7 #
8 use strict; use warnings;
09 package POE::Component::SSLify::ServerHandle;
1 use strict; use warnings;
2
3 # Initialize our version
4 use vars qw( $VERSION );
5 $VERSION = '0.20';
10 BEGIN {
11 $POE::Component::SSLify::ServerHandle::VERSION = '1.002';
12 }
13 BEGIN {
14 $POE::Component::SSLify::ServerHandle::AUTHORITY = 'cpan:APOCAL';
15 }
16
17 # ABSTRACT: Server-side handle for SSLify
618
719 # Import the SSL death routines
820 use Net::SSLeay qw( die_now die_if_ssl_error );
156168 die 'Not Implemented';
157169 }
158170
159 # End of module
160171 1;
161172
173
162174 __END__
175 =pod
163176
164177 =head1 NAME
165178
166 POE::Component::SSLify::ServerHandle - server object for POE::Component::SSLify
167
168 =head1 ABSTRACT
169
170 See POE::Component::SSLify
179 POE::Component::SSLify::ServerHandle - Server-side handle for SSLify
180
181 =head1 VERSION
182
183 This document describes v1.002 of POE::Component::SSLify::ServerHandle - released February 19, 2011 as part of POE-Component-SSLify.
171184
172185 =head1 DESCRIPTION
173186
183196
184197 =head1 SEE ALSO
185198
199 Please see those modules/websites for more information related to this module.
200
201 =over 4
202
203 =item *
204
186205 L<POE::Component::SSLify>
187206
207 =back
208
188209 =head1 AUTHOR
189210
190 Apocalypse E<lt>apocal@cpan.orgE<gt>
211 Apocalypse <APOCAL@cpan.org>
191212
192213 =head1 COPYRIGHT AND LICENSE
193214
194 Copyright 2010 by Apocalypse
195
196 This library is free software; you can redistribute it and/or modify
197 it under the same terms as Perl itself.
215 This software is copyright (c) 2011 by Apocalypse.
216
217 This is free software; you can redistribute it and/or modify it under
218 the same terms as the Perl 5 programming language system itself.
219
220 The full text of the license can be found in the LICENSE file included with this distribution.
198221
199222 =cut
223
0 #
1 # This file is part of POE-Component-SSLify
2 #
3 # This software is copyright (c) 2011 by Apocalypse.
4 #
5 # This is free software; you can redistribute it and/or modify it under
6 # the same terms as the Perl 5 programming language system itself.
7 #
8 use strict; use warnings;
09 package POE::Component::SSLify;
1 use strict; use warnings;
2
3 # Initialize our version
4 use vars qw( $VERSION );
5 $VERSION = '0.20';
10 BEGIN {
11 $POE::Component::SSLify::VERSION = '1.002';
12 }
13 BEGIN {
14 $POE::Component::SSLify::AUTHORITY = 'cpan:APOCAL';
15 }
16
17 # ABSTRACT: Makes using SSL in the world of POE easy!
618
719 # We need Net::SSLeay or all's a failure!
820 BEGIN {
9 eval {
10 require Net::SSLeay;
11
12 # We need >= 1.36 because it contains a lot of important fixes
13 Net::SSLeay->import( 1.36 );
14 };
21 # We need >= 1.36 because it contains a lot of important fixes
22 eval "use Net::SSLeay 1.36 qw( die_now die_if_ssl_error )";
1523
1624 # Check for errors...
1725 if ( $@ ) {
1826 # Oh boy!
1927 die $@;
2028 } else {
21 # Finally, load our subclass :)
29 # Finally, load our subclasses :)
2230 # ClientHandle isa ServerHandle so it will get loaded automatically
2331 require POE::Component::SSLify::ClientHandle;
2432
2634 # Taken from http://search.cpan.org/~flora/Net-SSLeay-1.36/lib/Net/SSLeay.pm#Low_level_API
2735 Net::SSLeay::load_error_strings();
2836 Net::SSLeay::SSLeay_add_ssl_algorithms();
37 # TODO do we need this?
38 #Net::SSLeay::ENGINE_load_builtin_engines(); # If you want built-in engines
39 #Net::SSLeay::ENGINE_register_all_complete(); # If you want built-in engines
2940 Net::SSLeay::randomize();
3041 }
3142 }
3445 require Exporter;
3546 use vars qw( @ISA @EXPORT_OK );
3647 @ISA = qw( Exporter );
37 @EXPORT_OK = qw( Client_SSLify Server_SSLify SSLify_Options SSLify_GetCTX SSLify_GetCipher SSLify_GetSocket SSLify_ContextCreate );
48 @EXPORT_OK = qw( Client_SSLify Server_SSLify SSLify_Options SSLify_GetCTX SSLify_GetCipher SSLify_GetSocket SSLify_GetSSL SSLify_ContextCreate );
3849
3950 # Bring in some socket-related stuff
4051 use Symbol qw( gensym );
41 use POSIX qw( F_GETFL F_SETFL O_NONBLOCK EAGAIN EWOULDBLOCK );
42
43 # We need the server-side stuff
44 use Net::SSLeay qw( die_now die_if_ssl_error );
52
53 # we need IO 1.24 for it's win32 fixes but it includes IO::Handle 1.27_02 which is dev...
54 # unfortunately we have to jump to IO 1.25 which includes IO::Handle 1.28... argh!
55 use IO::Handle 1.28;
4556
4657 # The server-side CTX stuff
4758 my $ctx = undef;
4859
49 # Helper sub to set nonblocking on a handle
50 sub _NonBlocking {
51 my $socket = shift;
52
53 # ActiveState Perl 5.8.0 dislikes the Win32-specific code to make
54 # a socket blocking, so we use IO::Handle's blocking(0) method.
55 # Perl 5.005_03 doesn't like blocking(), so we only use it in
56 # 5.8.0 and beyond.
57 if ( $] >= 5.008 and $^O eq 'MSWin32' ) {
58 # TODO investigate this?
59 # <kmx> kthakore: Apocalypse: FYI - as regards no-blocking socket dark magic commited to FB while ago - IO::Socket 1.24 (=May/2009) and later supports on Win32 simply $socket->blocking(0);
60 # <Apocalypse> kmx: Ah didn't know that - maybe I can use that :)
61 # <kmx> Apocalypse: I uderstand that used workaround is from pre IO::Socket 1.24 times
62 # <Apocalypse> Ah, my code already did that eh
63 # <Apocalypse> if ( $] >= 5.008 and $^O eq 'MSWin32' ) {
64 # <Apocalypse> But maybe 5.008 check isn't enough?
65 # <kmx> Apocalypse: You'd better check version of IO - see changelog http://cpansearch.perl.org/src/GBARR/IO-1.25/ChangeLog
66 # <Apocalypse> Hmm yeah
67 # <Apocalypse> * Make non-blocking mode work on Windows in IO::Socket::INET
68 # <kmx> Apocalypse: exactly
69 # <Apocalypse> Thanks for the tip! I'll go and add a TODO to the sslify code to investigate that :)
70
71
72 # From IO::Handle POD
73 # If an error occurs blocking will return undef and $! will be set.
74 if ( ! $socket->blocking( 0 ) ) {
75 die "Unable to set nonblocking mode on socket: $!";
76 }
77 } else {
78 # Make the handle nonblocking, the POSIX way.
79 if ( $^O ne 'MSWin32' ) {
80 # Get the old flags
81 my $flags = fcntl( $socket, F_GETFL, 0 ) or die "fcntl( $socket, F_GETFL, 0 ) fails: $!";
82
83 # Okay, we patiently wait until the socket turns nonblocking mode
84 until( fcntl( $socket, F_SETFL, $flags | O_NONBLOCK ) ) {
85 # What was the error?
86 if ( ! ( $! == EAGAIN or $! == EWOULDBLOCK ) ) {
87 # Fatal error...
88 die "fcntl( $socket, FSETFL, etc ) fails: $!";
89 }
90 }
91 } else {
92 # Darned MSWin32 way...
93 # Do some ioctl magic here
94 # 126 is FIONBIO ( some docs say 0x7F << 16 )
95 my $flag = "1";
96 ioctl( $socket, 0x80000000 | ( 4 << 16 ) | ( ord( 'f' ) << 8 ) | 126, $flag ) or die "ioctl( $socket, FIONBIO, $flag ) fails: $!";
97 }
98 }
99
100 # All done!
101 return $socket;
102 }
103
104 # Okay, the main routine here!
60
10561 sub Client_SSLify {
10662 # Get the socket + version + options + ctx
10763 my( $socket, $version, $options, $ctx ) = @_;
11167 die "Did not get a defined socket";
11268 }
11369
114 # Set non-blocking
115 $socket = _NonBlocking( $socket );
70 # From IO::Handle POD
71 # If an error occurs blocking will return undef and $! will be set.
72 if ( ! defined $socket->blocking( 0 ) ) {
73 die "Unable to set nonblocking mode on socket: $!";
74 }
11675
11776 # Now, we create the new socket and bind it to our subclass of Net::SSLeay::Handle
11877 my $newsock = gensym();
12281 return $newsock;
12382 }
12483
125 # Okay, the main routine here!
84
12685 sub Server_SSLify {
12786 # Get the socket!
12887 my $socket = shift;
13897 die 'Please do SSLify_Options() first ( or pass in a $ctx object )';
13998 }
14099
141 # Set non-blocking
142 $socket = _NonBlocking( $socket );
100 # From IO::Handle POD
101 # If an error occurs blocking will return undef and $! will be set.
102 if ( ! defined $socket->blocking( 0 ) ) {
103 die "Unable to set nonblocking mode on socket: $!";
104 }
143105
144106 # Now, we create the new socket and bind it to our subclass of Net::SSLeay::Handle
145107 my $newsock = gensym();
149111 return $newsock;
150112 }
151113
114
152115 sub SSLify_ContextCreate {
153116 # Get the key + cert + version + options
154117 my( $key, $cert, $version, $options ) = @_;
155118
156119 return _createSSLcontext( $key, $cert, $version, $options );
157120 }
121
158122
159123 sub SSLify_Options {
160124 # Get the key + cert + version + options
227191 return $context;
228192 }
229193
230 # Returns the server-side CTX in case somebody wants to play with it
194
231195 sub SSLify_GetCTX {
232196 my $sock = shift;
233197 if ( ! defined $sock ) {
237201 }
238202 }
239203
240 # Gives you the cipher type of a SSLified socket
204
241205 sub SSLify_GetCipher {
242206 my $sock = shift;
243207 return Net::SSLeay::get_cipher( tied( *$sock )->{'ssl'} );
244208 }
245209
246 # Gives you the "Real" Socket to play with
210
247211 sub SSLify_GetSocket {
248212 my $sock = shift;
249213 return tied( *$sock )->{'socket'};
250214 }
251215
252 # End of module
216
217 sub SSLify_GetSSL {
218 my $sock = shift;
219 return tied( *$sock )->{'ssl'};
220 }
221
253222 1;
223
224
254225 __END__
255
256 =for stopwords AnnoCPAN CPAN CPANTS Kwalitee RT SSL com diff github FreeBSD OpenSSL
226 =pod
257227
258228 =head1 NAME
259229
260230 POE::Component::SSLify - Makes using SSL in the world of POE easy!
231
232 =head1 VERSION
233
234 This document describes v1.002 of POE::Component::SSLify - released February 19, 2011 as part of POE-Component-SSLify.
261235
262236 =head1 SYNOPSIS
263237
266240 # Import the module
267241 use POE::Component::SSLify qw( Client_SSLify );
268242
269 # Create a normal SocketFactory wheel or something
243 # Create a normal SocketFactory wheel and connect to a SSL-enabled server
270244 my $factory = POE::Wheel::SocketFactory->new;
271245
272246 # Time passes, SocketFactory gives you a socket when it connects in SuccessEvent
273 # Converts the socket into a SSL socket POE can communicate with
247 # Convert the socket into a SSL socket POE can communicate with
274248 my $socket = shift;
275249 eval { $socket = Client_SSLify( $socket ) };
276250 if ( $@ ) {
283257 # other options as usual
284258 );
285259
286 # Use it as you wish...
287 # End of example
288
289260 # --------------------------------------------------------------------------- #
290261
291262 # SERVER-side usage
292263
293 # !!! Make sure you have a public key + certificate generated via Net::SSLeay's makecert.pl
264 # !!! Make sure you have a public key + certificate
294265 # excellent howto: http://www.akadia.com/services/ssh_test_certificate.html
295266
296267 # Import the module
302273 # Unable to load key or certificate file...
303274 }
304275
305 # Create a normal SocketFactory wheel or something
276 # Create a normal SocketFactory wheel to listen for connections
306277 my $factory = POE::Wheel::SocketFactory->new;
307278
308279 # Time passes, SocketFactory gives you a socket when it gets a connection in SuccessEvent
309 # Converts the socket into a SSL socket POE can communicate with
280 # Convert the socket into a SSL socket POE can communicate with
310281 my $socket = shift;
311282 eval { $socket = Server_SSLify( $socket ) };
312283 if ( $@ ) {
319290 # other options as usual
320291 );
321292
322 # Use it as you wish...
323 # End of example
324
325 =head1 ABSTRACT
326
327 Makes SSL use in POE a breeze!
328
329293 =head1 DESCRIPTION
330294
331295 This component represents the standard way to do SSL in POE.
332
333 =head1 NOTES
334
335 =head2 Socket methods doesn't work
336
337 The new socket this module gives you actually is some tied socket magic, so you cannot do stuff like
338 getpeername() or getsockname(). The only way to do it is to use SSLify_GetSocket and then operate on
339 the socket it returns.
340
341 =head2 Dying everywhere...
342
343 This module will die() if Net::SSLeay could not be loaded or it is not the version we want. So, it is recommended
344 that you check for errors and not use SSL, like so:
345
346 eval { use POE::Component::SSLify };
347 if ( $@ ) {
348 $sslavailable = 0;
349 } else {
350 $sslavailable = 1;
351 }
352
353 # Make socket SSL!
354 if ( $sslavailable ) {
355 eval { $socket = POE::Component::SSLify::Client_SSLify( $socket ) };
356 if ( $@ ) {
357 # Unable to SSLify the socket...
358 }
359 }
360
361 =head2 OpenSSL functions
362
363 Theoretically you can do anything that Net::SSLeay exports from the OpenSSL libs on the socket. However, I have not tested every
364 possible function against SSLify, so use them carefully! If you have success, please report back to me so I can update this doc!
365
366 =head3 Net::SSLeay::renegotiate
367
368 This function has been tested ( it's in t/3_renegotiate.t ) but it doesn't work on FreeBSD! I tracked it down to this security advisory:
369 L<http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc> which explains it in detail. The test will skip this function
370 if it detects that you're on a broken system. However, if you have the updated OpenSSL library that fixes this you can use it.
371296
372297 =head1 FUNCTIONS
373298
412337 Furthermore, you can pass in your own $ctx object if you desire. This allows you to set custom parameters
413338 per-connection, for example.
414339 my $socket = shift; # get the socket from somewhere
415 my $ctx = Net::SSLeay::CTX_new();
340 my $ctx = SSLify_ContextCreate();
416341 # set various options on $ctx as desired
417342 $socket = Server_SSLify( $socket, $ctx );
418343
419344 NOTE: You can use SSLify_GetCTX to modify the global, and avoid doing this on every connection if the
420345 options are the same...
421346
422 =head2 SSLify_Options
423
424 Accepts the location of the SSL key + certificate files and does it's job
425
426 Optionally accepts the SSL version + CTX options
427 SSLify_Options( $key, $cert, $version, $options );
428
429 Known versions:
347 =head2 SSLify_ContextCreate
348
349 Accepts some options, and returns a brand-new Net::SSLeay context object ( $ctx )
350 my $ctx = SSLify_ContextCreate( $key, $cert, $version, $options );
351
352 You can then call various Net::SSLeay methods on the context
353 my $mode = Net::SSLeay::CTX_get_mode( $ctx );
354
355 By default we don't use the SSL key + certificate files
356
357 By default we use the version: default
358
359 Known versions:
430360 * sslv2
431361 * sslv3
432362 * tlsv1
433363 * default
434364
365 By default we don't set any options
366
367 =head2 SSLify_Options
368
369 Call this function to initialize the global server-side CTX. Accepts the location of the
370 SSL key + certificate files, which is required.
371
372 Optionally accepts the SSL version + CTX options
373 SSLify_Options( $key, $cert, $version, $options );
374
435375 By default we use the version: default
436376
377 Known versions:
378 * sslv2
379 * sslv3
380 * tlsv1
381 * default
382
437383 By default we use the options: &Net::SSLeay::OP_ALL
438384
439385 =head2 SSLify_GetCTX
440386
441 Returns the server-side CTX in case you wanted to play around with it :)
387 Returns the actual Net::SSLeay context object in case you wanted to play with it :)
442388
443389 If passed in a socket, it will return that socket's $ctx instead of the global.
444390 my $ctx = SSLify_GetCTX(); # get the one set via SSLify_Options
472418 Example:
473419 print "Remote IP is: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $sslified_sock ) ) ) )[1] ) . "\n";
474420
475 =head2 SSLify_ContextCreate
476
477 Accepts some options, and returns a brand-new SSL context object ( $ctx )
478 my $ctx = SSLify_ContextCreate();
479 my $ctx = SSLify_ContextCreate( $key, $cert );
480 my $ctx = SSLify_ContextCreate( $key, $cert, $version, $options );
481
482 Known versions:
483 * sslv2
484 * sslv3
485 * tlsv1
486 * default
487
488 By default we use the version: default
489
490 By default we don't set any options
491
492 By default we don't use the SSL key + certificate files
421 =head2 SSLify_GetSSL
422
423 Returns the actual Net::SSLeay object so you can call methods on it
424
425 Example:
426 print Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $sslified_sock ) );
427
428 =head1 NOTES
429
430 =head2 Socket methods doesn't work
431
432 The new socket this module gives you actually is some tied socket magic, so you cannot do stuff like
433 getpeername() or getsockname(). The only way to do it is to use SSLify_GetSocket and then operate on
434 the socket it returns.
435
436 =head2 Dying everywhere...
437
438 This module will die() if Net::SSLeay could not be loaded or it is not the version we want. So, it is recommended
439 that you check for errors and not use SSL, like so:
440
441 eval { use POE::Component::SSLify };
442 if ( $@ ) {
443 $sslavailable = 0;
444 } else {
445 $sslavailable = 1;
446 }
447
448 # Make socket SSL!
449 if ( $sslavailable ) {
450 eval { $socket = POE::Component::SSLify::Client_SSLify( $socket ) };
451 if ( $@ ) {
452 # Unable to SSLify the socket...
453 }
454 }
455
456 =head2 OpenSSL functions
457
458 Theoretically you can do anything that Net::SSLeay exports from the OpenSSL libs on the socket. However, I have not tested every
459 possible function against SSLify, so use them carefully!
460
461 =head3 Net::SSLeay::renegotiate
462
463 This function has been tested ( it's in C<t/2_renegotiate.t> ) but it doesn't work on FreeBSD! I tracked it down to this security advisory:
464 L<http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc> which explains it in detail. The test will skip this function
465 if it detects that you're on a broken system. However, if you have the updated OpenSSL library that fixes this you can use it.
466
467 =head3 In-Situ sslification
468
469 You can have a normal plaintext socket, and convert it to SSL anytime. Just keep in mind that the client and the server must agree to sslify
470 at the same time, or they will be waiting on each other forever! See C<t/3_insitu.t> for an example of how this works.
493471
494472 =head1 EXPORT
495473
496474 Stuffs all of the above functions in @EXPORT_OK so you have to request them directly
497475
476 =head1 SEE ALSO
477
478 Please see those modules/websites for more information related to this module.
479
480 =over 4
481
482 =item *
483
484 L<POE>
485
486 =item *
487
488 L<Net::SSLeay>
489
490 =back
491
492 =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders
493
498494 =head1 SUPPORT
499495
496 =head2 Perldoc
497
500498 You can find documentation for this module with the perldoc command.
501499
502 perldoc POE::Component::SSLify
500 perldoc POE::Component::SSLify
503501
504502 =head2 Websites
505503
504 The following websites have more information about this module, and may be of help to you. As always,
505 in addition to those websites please use your favorite search engine to discover more resources.
506
506507 =over 4
507508
508 =item * Search CPAN
509 =item *
510
511 Search CPAN
509512
510513 L<http://search.cpan.org/dist/POE-Component-SSLify>
511514
512 =item * AnnoCPAN: Annotated CPAN documentation
515 =item *
516
517 RT: CPAN's Bug Tracker
518
519 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify>
520
521 =item *
522
523 AnnoCPAN: Annotated CPAN documentation
513524
514525 L<http://annocpan.org/dist/POE-Component-SSLify>
515526
516 =item * CPAN Ratings
527 =item *
528
529 CPAN Ratings
517530
518531 L<http://cpanratings.perl.org/d/POE-Component-SSLify>
519532
520 =item * CPAN Forum
533 =item *
534
535 CPAN Forum
521536
522537 L<http://cpanforum.com/dist/POE-Component-SSLify>
523538
524 =item * RT: CPAN's Request Tracker
525
526 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify>
527
528 =item * CPANTS Kwalitee
539 =item *
540
541 CPANTS Kwalitee
529542
530543 L<http://cpants.perl.org/dist/overview/POE-Component-SSLify>
531544
532 =item * CPAN Testers Results
545 =item *
546
547 CPAN Testers Results
533548
534549 L<http://cpantesters.org/distro/P/POE-Component-SSLify.html>
535550
536 =item * CPAN Testers Matrix
551 =item *
552
553 CPAN Testers Matrix
537554
538555 L<http://matrix.cpantesters.org/?dist=POE-Component-SSLify>
539556
540 =item * Git Source Code Repository
541
542 This code is currently hosted on github.com under the account "apocalypse". Please feel free to browse it
543 and pull from it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
557 =back
558
559 =head2 Email
560
561 You can email the author of this module at C<APOCAL at cpan.org> asking for help with any problems you have.
562
563 =head2 Internet Relay Chat
564
565 You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is,
566 please read this excellent guide: L<http://en.wikipedia.org/wiki/Internet_Relay_Chat>. Please
567 be courteous and patient when talking to us, as we might be busy or sleeping! You can join
568 those networks/channels and get help:
569
570 =over 4
571
572 =item *
573
574 irc.perl.org
575
576 You can connect to the server at 'irc.perl.org' and join this channel: #perl-help then talk to this person for help: Apocalypse.
577
578 =item *
579
580 irc.freenode.net
581
582 You can connect to the server at 'irc.freenode.net' and join this channel: #perl then talk to this person for help: Apocal.
583
584 =item *
585
586 irc.efnet.org
587
588 You can connect to the server at 'irc.efnet.org' and join this channel: #perl then talk to this person for help: Ap0cal.
589
590 =back
591
592 =head2 Bugs / Feature Requests
593
594 Please report any bugs or feature requests by email to C<bug-poe-component-sslify at rt.cpan.org>, or through
595 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-SSLify>. You will be automatically notified of any
596 progress on the request by the system.
597
598 =head2 Source Code
599
600 The code is open to the world, and available for you to hack on. Please feel free to browse it and play
601 with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
544602 from your repository :)
545603
546604 L<http://github.com/apocalypse/perl-poe-sslify>
547605
548 =back
549
550 =head2 Bugs
551
552 Please report any bugs or feature requests to C<bug-poe-component-sslify at rt.cpan.org>, or through
553 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-SSLify>. I will be
554 notified, and then you'll automatically be notified of progress on your bug as I make changes.
555
556 =head1 SEE ALSO
557
558 L<POE>
559
560 L<Net::SSLeay>
606 git clone git://github.com/apocalypse/perl-poe-sslify.git
561607
562608 =head1 AUTHOR
563609
564 Apocalypse E<lt>apocal@cpan.orgE<gt>
610 Apocalypse <APOCAL@cpan.org>
611
612 =head1 ACKNOWLEDGEMENTS
565613
566614 Original code is entirely Rocco Caputo ( Creator of POE ) -> I simply
567615 packaged up the code into something everyone could use and accepted the burden
577625
578626 =head1 COPYRIGHT AND LICENSE
579627
580 Copyright 2010 by Apocalypse/Rocco Caputo/Dariusz Jackowski
581
582 This library is free software; you can redistribute it and/or modify
583 it under the same terms as Perl itself.
584
585 The full text of the license can be found in the LICENSE file included with this module.
628 This software is copyright (c) 2011 by Apocalypse.
629
630 This is free software; you can redistribute it and/or modify it under
631 the same terms as the Perl 5 programming language system itself.
632
633 The full text of the license can be found in the LICENSE file included with this distribution.
586634
587635 =cut
636
0 #!perl
1 #
2 # This file is part of POE-Component-SSLify
3 #
4 # This software is copyright (c) 2011 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 use strict; use warnings;
10
11 use strict;
12 use warnings;
13
14 use Test::More;
15
16
17
18 use File::Find;
19 use File::Temp qw{ tempdir };
20
21 my @modules;
22 find(
23 sub {
24 return if $File::Find::name !~ /\.pm\z/;
25 my $found = $File::Find::name;
26 $found =~ s{^lib/}{};
27 $found =~ s{[/\\]}{::}g;
28 $found =~ s/\.pm$//;
29 # nothing to skip
30 push @modules, $found;
31 },
32 'lib',
33 );
34
35 my @scripts = glob "bin/*";
36
37 my $plan = scalar(@modules) + scalar(@scripts);
38 $plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
39
40 {
41 # fake home for cpan-testers
42 local $ENV{HOME} = tempdir( CLEANUP => 1 );
43
44 like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" )
45 for sort @modules;
46
47 SKIP: {
48 eval "use Test::Script 1.05; 1;";
49 skip "Test::Script needed to test script compilation", scalar(@scripts) if $@;
50 foreach my $file ( @scripts ) {
51 my $script = $file;
52 $script =~ s!.*/!!;
53 script_compiles( $file, "$script script compiles" );
54 }
55 }
56 }
0 use strict;
1 use warnings;
2 use Test::More 0.88;
3 # This is a relatively nice way to avoid Test::NoWarnings breaking our
4 # expectations by adding extra tests, without using no_plan. It also helps
5 # avoid any other test module that feels introducing random tests, or even
6 # test plans, is a nice idea.
7 our $success = 0;
8 END { $success && done_testing; }
9
10 my $v = "\n";
11
12 eval { # no excuses!
13 # report our Perl details
14 my $want = '5.006';
15 my $pv = ($^V || $]);
16 $v .= "perl: $pv (wanted $want) on $^O from $^X\n\n";
17 };
18 defined($@) and diag("$@");
19
20 # Now, our module version dependencies:
21 sub pmver {
22 my ($module, $wanted) = @_;
23 $wanted = " (want $wanted)";
24 my $pmver;
25 eval "require $module;";
26 if ($@) {
27 if ($@ =~ m/Can't locate .* in \@INC/) {
28 $pmver = 'module not found.';
29 } else {
30 diag("${module}: $@");
31 $pmver = 'died during require.';
32 }
33 } else {
34 my $version;
35 eval { $version = $module->VERSION; };
36 if ($@) {
37 diag("${module}: $@");
38 $pmver = 'died during VERSION check.';
39 } elsif (defined $version) {
40 $pmver = "$version";
41 } else {
42 $pmver = '<undef>';
43 }
44 }
45
46 # So, we should be good, right?
47 return sprintf('%-45s => %-10s%-15s%s', $module, $pmver, $wanted, "\n");
48 }
49
50 eval { $v .= pmver('Exporter','any version') };
51 eval { $v .= pmver('File::Find','any version') };
52 eval { $v .= pmver('File::Temp','any version') };
53 eval { $v .= pmver('IO::Handle','1.28') };
54 eval { $v .= pmver('Module::Build','0.3601') };
55 eval { $v .= pmver('Net::SSLeay','any version') };
56 eval { $v .= pmver('POE','1.267') };
57 eval { $v .= pmver('POE::Component::Client::TCP','any version') };
58 eval { $v .= pmver('POE::Component::Server::TCP','any version') };
59 eval { $v .= pmver('Socket','any version') };
60 eval { $v .= pmver('Symbol','any version') };
61 eval { $v .= pmver('Test::More','0.88') };
62 eval { $v .= pmver('vars','any version') };
63
64
65
66 # All done.
67 $v .= <<'EOT';
68
69 Thanks for using my code. I hope it works for you.
70 If not, please try and include this output in the bug report.
71 That will help me reproduce the issue and solve you problem.
72
73 EOT
74
75 diag($v);
76 ok(1, "we really didn't test anything, just reporting data");
77 $success = 1;
78
79 # Work around another nasty module on CPAN. :/
80 no warnings 'once';
81 $Template::Test::NO_FLUSH = 1;
82 exit 0;
+0
-20
t/1_load.t less more
0 #!/usr/bin/perl
1 use strict; use warnings;
2
3 my $numtests;
4 BEGIN {
5 $numtests = 3;
6
7 eval "use Test::NoWarnings";
8 if ( ! $@ ) {
9 # increment by one
10 $numtests++;
11
12 }
13 }
14
15 use Test::More tests => $numtests;
16
17 use_ok( 'POE::Component::SSLify::ServerHandle' );
18 use_ok( 'POE::Component::SSLify::ClientHandle' );
19 use_ok( 'POE::Component::SSLify' );
0 #!/usr/bin/perl
1 #
2 # This file is part of POE-Component-SSLify
3 #
4 # This software is copyright (c) 2011 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 use strict; use warnings;
10
11 # Thanks to ASCENT for this test!
12
13 use strict; use warnings;
14
15 my $numtests;
16 BEGIN {
17 $numtests = 16;
18
19 eval "use Test::NoWarnings";
20 if ( ! $@ ) {
21 # increment by one
22 $numtests++;
23
24 }
25 }
26
27 use Test::More tests => $numtests;
28
29 use POE 1.267;
30 use POE::Component::Client::TCP;
31 use POE::Component::Server::TCP;
32 use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/;
33
34 # TODO rewrite this to use Test::POE::Server::TCP and stuff :)
35
36 my $port;
37
38 POE::Component::Server::TCP->new
39 (
40 Alias => 'myserver',
41 Address => '127.0.0.1',
42 Port => 0,
43
44 Started => sub
45 {
46 use Socket qw/sockaddr_in/;
47 $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0];
48 },
49 ClientConnected => sub
50 {
51 ok(1, 'SERVER: accepted');
52 },
53 ClientDisconnected => sub
54 {
55 ok(1, 'SERVER: client disconnected');
56 $_[KERNEL]->post(myserver => 'shutdown');
57 },
58 ClientPreConnect => sub
59 {
60 eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') };
61 eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@);
62 ok(!$@, "SERVER: SSLify_Options $@");
63
64 my $socket = eval { Server_SSLify($_[ARG0]) };
65 ok(!$@, "SERVER: Server_SSLify $@");
66 ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket));
67
68 # We pray that IO::Handle is sane...
69 ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?');
70
71 return ($socket);
72 },
73 ClientInput => sub
74 {
75 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
76
77 if ( $line eq 'ping' ) {
78 ok(1, "SERVER: recv: $line");
79
80 ## At this point, connection MUST be encrypted.
81 my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle);
82 ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher");
83
84 $heap->{client}->put("pong");
85 } else {
86 die "Unknown line from CLIENT: $line";
87 }
88 },
89 ClientError => sub
90 {
91 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
92 # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
93 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
94
95 # TODO are there other "errors" that is harmless?
96 $error = "Normal disconnection" unless $error;
97 my $msg = "Got SERVER $syscall error $errno: $error";
98 unless ( $syscall eq 'read' and $errno == 0 ) {
99 fail( $msg );
100 } else {
101 diag( $msg ) if $ENV{TEST_VERBOSE};
102 }
103 },
104 );
105
106 POE::Component::Client::TCP->new
107 (
108 Alias => 'myclient',
109 RemoteAddress => '127.0.0.1',
110 RemotePort => $port,
111 Connected => sub
112 {
113 ok(1, 'CLIENT: connected');
114
115 $_[HEAP]->{server}->put("ping");
116 },
117 PreConnect => sub
118 {
119 my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') };
120 ok(!$@, "CLIENT: SSLify_ContextCreate $@");
121 my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) };
122 ok(!$@, "CLIENT: Client_SSLify $@");
123 ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket));
124
125 # We pray that IO::Handle is sane...
126 ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?');
127
128 return ($socket);
129 },
130 ServerInput => sub
131 {
132 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
133
134 if ($line eq 'pong') {
135 ok(1, "CLIENT: recv: $line");
136
137 ## At this point, connection MUST be encrypted.
138 my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle);
139 ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher");
140 diag( Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ) ) if $ENV{TEST_VERBOSE};
141
142 $kernel->yield('shutdown');
143 } else {
144 die "Unknown line from SERVER: $line";
145 }
146 },
147 ServerError => sub
148 {
149 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
150 # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
151 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
152
153 # TODO are there other "errors" that is harmless?
154 $error = "Normal disconnection" unless $error;
155 my $msg = "Got CLIENT $syscall error $errno: $error";
156 unless ( $syscall eq 'read' and $errno == 0 ) {
157 fail( $msg );
158 } else {
159 diag( $msg ) if $ENV{TEST_VERBOSE};
160 }
161 },
162 );
163
164 $poe_kernel->run();
165
166 pass( 'shut down sanely' );
167
168 exit 0;
0 #!/usr/bin/perl
1 #
2 # This file is part of POE-Component-SSLify
3 #
4 # This software is copyright (c) 2011 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 use strict; use warnings;
10
11 # Thanks to ASCENT for this test!
12
13 # This test adds renegotiation to the connection
14 # Since this is not supported on all platforms, it's marked TODO and adds custom logic
15 # to make sure it doesn't FAIL if it's not supported.
16
17 use strict; use warnings;
18
19 my $numtests;
20 BEGIN {
21 $numtests = 23;
22
23 eval "use Test::NoWarnings";
24 if ( ! $@ ) {
25 # increment by one
26 $numtests++;
27
28 }
29 }
30
31 use Test::More tests => $numtests;
32
33 use POE 1.267;
34 use POE::Component::Client::TCP;
35 use POE::Component::Server::TCP;
36 use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket/;
37 use Net::SSLeay qw/ERROR_WANT_READ ERROR_WANT_WRITE/;
38
39 # TODO rewrite this to use Test::POE::Server::TCP and stuff :)
40
41 my $port;
42 my $server_ping2;
43 my $client_ping2;
44
45 POE::Component::Server::TCP->new
46 (
47 Alias => 'myserver',
48 Address => '127.0.0.1',
49 Port => 0,
50
51 Started => sub
52 {
53 use Socket qw/sockaddr_in/;
54 $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0];
55 },
56 ClientConnected => sub
57 {
58 ok(1, 'SERVER: accepted');
59 },
60 ClientDisconnected => sub
61 {
62 ok(1, 'SERVER: client disconnected');
63 $_[KERNEL]->post(myserver => 'shutdown');
64 },
65 ClientPreConnect => sub
66 {
67 eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') };
68 eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@);
69 ok(!$@, "SERVER: SSLify_Options $@");
70
71 my $socket = eval { Server_SSLify($_[ARG0]) };
72 ok(!$@, "SERVER: Server_SSLify $@");
73 ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket));
74
75 # We pray that IO::Handle is sane...
76 ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?');
77
78 return ($socket);
79 },
80 ClientInput => sub
81 {
82 my ($kernel, $heap, $request) = @_[KERNEL, HEAP, ARG0];
83
84 ## At this point, connection MUST be encrypted.
85 my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle);
86 ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher");
87
88 if ($request eq 'ping')
89 {
90 ok(1, "SERVER: recv: $request");
91 $heap->{client}->put("pong");
92 }
93 elsif ($request eq 'ping2')
94 {
95 ok(1, "SERVER: recv: $request");
96 $server_ping2++;
97 $heap->{client}->put("pong2");
98 }
99 },
100 ClientError => sub
101 {
102 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
103 # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
104 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
105
106 # TODO are there other "errors" that is harmless?
107 $error = "Normal disconnection" unless $error;
108 my $msg = "Got SERVER $syscall error $errno: $error";
109 unless ( $syscall eq 'read' and $errno == 0 ) {
110 fail( $msg );
111 } else {
112 diag( $msg ) if $ENV{TEST_VERBOSE};
113 }
114 },
115 );
116
117 POE::Component::Client::TCP->new
118 (
119 Alias => 'myclient',
120 RemoteAddress => '127.0.0.1',
121 RemotePort => $port,
122 Connected => sub
123 {
124 ok(1, 'CLIENT: connected');
125
126 $_[HEAP]->{server}->put("ping");
127 },
128 PreConnect => sub
129 {
130 my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') };
131 ok(!$@, "CLIENT: SSLify_ContextCreate $@");
132 my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) };
133 ok(!$@, "CLIENT: Client_SSLify $@");
134 ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket));
135
136 # We pray that IO::Handle is sane...
137 ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?');
138
139 return ($socket);
140 },
141 ServerInput => sub
142 {
143 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
144
145 ## At this point, connection MUST be encrypted.
146 my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle);
147 ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher");
148
149 if ($line eq 'pong')
150 {
151 ok(1, "CLIENT: recv: $line");
152
153 # Skip 2 Net::SSLeay::renegotiate() tests on FreeBSD because of
154 # http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc
155 TODO: {
156 local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms";
157
158 ## Force SSL renegotiation
159 my $ssl = tied(*{$heap->{server}->get_output_handle})->{ssl};
160 my $reneg_num = Net::SSLeay::num_renegotiations($ssl);
161
162 ok(1 == Net::SSLeay::renegotiate($ssl), 'CLIENT: SSL renegotiation');
163 my $handshake = Net::SSLeay::do_handshake($ssl);
164 my $err = Net::SSLeay::get_error($ssl, $handshake);
165
166 ## 1 == Successful handshake, ERROR_WANT_(READ|WRITE) == non-blocking.
167 ok($handshake == 1 || $err == ERROR_WANT_READ || $err == ERROR_WANT_WRITE, 'CLIENT: SSL handshake');
168 ok($reneg_num < Net::SSLeay::num_renegotiations($ssl), 'CLIENT: Increased number of negotiations');
169 }
170
171 $heap->{server}->put('ping2');
172 }
173
174 elsif ($line eq 'pong2')
175 {
176 ok(1, "CLIENT: recv: $line");
177 $client_ping2++;
178 $kernel->yield('shutdown');
179 }
180 },
181 ServerError => sub
182 {
183 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
184 # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
185 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
186
187 # TODO are there other "errors" that is harmless?
188 $error = "Normal disconnection" unless $error;
189 my $msg = "Got CLIENT $syscall error $errno: $error";
190 unless ( $syscall eq 'read' and $errno == 0 ) {
191 fail( $msg );
192 } else {
193 diag( $msg ) if $ENV{TEST_VERBOSE};
194 }
195 },
196 );
197
198 $poe_kernel->run();
199
200 # Add extra pass() to make the test harness happy if renegotiate did not work
201 if ( ! $server_ping2 ) {
202 local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms";
203 fail( "SERVER: Failed SSL renegotiation" );
204 }
205 if ( ! $client_ping2 ) {
206 local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms";
207 fail( "CLIENT: Failed SSL renegotiation" );
208 }
209 if ( ! $server_ping2 or ! $client_ping2 ) {
210 diag( "WARNING: Your platform/SSL library does not support renegotiation of the SSL socket." );
211 diag( "This test harness detected that trying to renegotiate resulted in a disconnected socket." );
212 diag( "POE::Component::SSLify will work on your system, but please do not attempt a SSL renegotiate." );
213 diag( "Please talk with the author to figure out if this issue can be worked around, thank you!" );
214 }
215
216 pass( 'shut down sanely' );
217
218 exit 0;
+0
-157
t/2_simple.t less more
0 #!/usr/bin/perl
1
2 # Thanks to ASCENT for this test!
3
4 use strict; use warnings;
5
6 my $numtests;
7 BEGIN {
8 $numtests = 16;
9
10 eval "use Test::NoWarnings";
11 if ( ! $@ ) {
12 # increment by one
13 $numtests++;
14
15 }
16 }
17
18 use Test::More tests => $numtests;
19
20 use POE;
21 use POE::Component::Client::TCP;
22 use POE::Component::Server::TCP;
23 use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate/;
24 use Net::SSLeay qw/ERROR_WANT_READ ERROR_WANT_WRITE/;
25 use POSIX qw/F_GETFL F_SETFL O_NONBLOCK EAGAIN EWOULDBLOCK/;
26
27 # TODO rewrite this to use Test::POE::Server::TCP and stuff :)
28
29 my $port;
30
31 POE::Component::Server::TCP->new
32 (
33 Alias => 'myserver',
34 Address => '127.0.0.1',
35 Port => 0,
36
37 Started => sub
38 {
39 use Socket qw/sockaddr_in/;
40 $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0];
41 },
42 ClientConnected => sub
43 {
44 ok(1, 'SERVER: accepted');
45 },
46 ClientDisconnected => sub
47 {
48 ok(1, 'SERVER: client disconnected');
49 $_[KERNEL]->post(myserver => 'shutdown');
50 },
51 ClientPreConnect => sub
52 {
53 eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') };
54 eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@);
55 ok(!$@, "SERVER: SSLify_Options $@");
56
57 my $socket = eval { Server_SSLify($_[ARG0]) };
58 ok(!$@, "SERVER: Server_SSLify $@");
59 ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket));
60
61 my $flags = fcntl($_[ARG0], F_GETFL, 0);
62 ok($flags & O_NONBLOCK, 'SERVER: SSLified socket is non-blocking?');
63
64 return ($socket);
65 },
66 ClientInput => sub
67 {
68 my ($kernel, $heap, $request) = @_[KERNEL, HEAP, ARG0];
69
70 ## At this point, connection MUST be encrypted.
71 my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle);
72 ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher");
73
74 if ($request eq 'ping')
75 {
76 ok(1, "SERVER: recv: $request");
77 $heap->{client}->put("pong");
78 }
79 },
80 ClientError => sub
81 {
82 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
83 # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
84 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
85
86 # TODO are there other "errors" that is harmless?
87 $error = "Normal disconnection" unless $error;
88 my $msg = "Got SERVER $syscall error $errno: $error";
89 unless ( $syscall eq 'read' and $errno == 0 ) {
90 fail( $msg );
91 } else {
92 diag( $msg ) if $ENV{TEST_VERBOSE};
93 }
94 },
95 );
96
97 POE::Component::Client::TCP->new
98 (
99 Alias => 'myclient',
100 RemoteAddress => '127.0.0.1',
101 RemotePort => $port,
102 Connected => sub
103 {
104 ok(1, 'CLIENT: connected');
105
106 $_[HEAP]->{server}->put("ping");
107 },
108 PreConnect => sub
109 {
110 my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') };
111 ok(!$@, "CLIENT: SSLify_ContextCreate $@");
112 my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) };
113 ok(!$@, "CLIENT: Client_SSLify $@");
114 ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket));
115
116 my $flags = fcntl($_[ARG0], F_GETFL, 0);
117 ok($flags & O_NONBLOCK, 'CLIENT: SSLified socket is non-blocking?');
118
119 return ($socket);
120 },
121 ServerInput => sub
122 {
123 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
124
125 ## At this point, connection MUST be encrypted.
126 my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle);
127 ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher");
128
129 if ($line eq 'pong')
130 {
131 ok(1, "CLIENT: recv: $line");
132 $kernel->yield('shutdown');
133 }
134 },
135 ServerError => sub
136 {
137 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
138 # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
139 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
140
141 # TODO are there other "errors" that is harmless?
142 $error = "Normal disconnection" unless $error;
143 my $msg = "Got CLIENT $syscall error $errno: $error";
144 unless ( $syscall eq 'read' and $errno == 0 ) {
145 fail( $msg );
146 } else {
147 diag( $msg ) if $ENV{TEST_VERBOSE};
148 }
149 },
150 );
151
152 $poe_kernel->run();
153
154 pass( 'shut down sanely' );
155
156 exit 0;
0 #!/usr/bin/perl
1 #
2 # This file is part of POE-Component-SSLify
3 #
4 # This software is copyright (c) 2011 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 use strict; use warnings;
10
11 # Thanks to ASCENT for this test!
12
13 use strict; use warnings;
14
15 my $numtests;
16 BEGIN {
17 $numtests = 18;
18
19 eval "use Test::NoWarnings";
20 if ( ! $@ ) {
21 # increment by one
22 $numtests++;
23
24 }
25 }
26
27 use Test::More tests => $numtests;
28
29 use POE 1.267;
30 use POE::Component::Client::TCP;
31 use POE::Component::Server::TCP;
32 use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket/;
33
34 # TODO rewrite this to use Test::POE::Server::TCP and stuff :)
35
36 my $port;
37
38 POE::Component::Server::TCP->new
39 (
40 Alias => 'myserver',
41 Address => '127.0.0.1',
42 Port => 0,
43
44 Started => sub
45 {
46 use Socket qw/sockaddr_in/;
47 $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0];
48 },
49 ClientConnected => sub
50 {
51 ok(1, 'SERVER: accepted');
52 },
53 ClientDisconnected => sub
54 {
55 ok(1, 'SERVER: client disconnected');
56 $_[KERNEL]->post(myserver => 'shutdown');
57 },
58 ClientInput => sub
59 {
60 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
61
62 if ( $line eq 'plaintext_ping' ) {
63 ok(1, "SERVER: recv: $line");
64 $heap->{client}->put('plaintext_pong');
65 $heap->{client}->flush; # make sure we sent the pong
66
67 # sslify it in-situ!
68 eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') };
69 eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@);
70 ok(!$@, "SERVER: SSLify_Options $@");
71 my $socket = eval { Server_SSLify($heap->{client}->get_output_handle) };
72 ok(!$@, "SERVER: Server_SSLify $@");
73 ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket));
74
75 # We pray that IO::Handle is sane...
76 ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?');
77
78 # TODO evil code here, ha!
79 # Should I ask rcaputo to add a $rw->replace_handle($socket) method?
80 # if you don't do the undef and just replace it - you'll get a bad file descriptor error from POE!
81 # <fh> select error: Bad file descriptor (hits=-1)
82 undef $heap->{client};
83 $heap->{client} = POE::Wheel::ReadWrite->new(
84 Handle => $socket,
85 InputEvent => 'tcp_server_got_input',
86 ErrorEvent => 'tcp_server_got_error',
87 FlushedEvent => 'tcp_server_got_flush',
88 );
89 } elsif ( $line eq 'ssl_ping' ) {
90 ok(1, "SERVER: recv: $line");
91
92 ## At this point, connection MUST be encrypted.
93 my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle);
94 ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher");
95
96 $heap->{client}->put('ssl_pong');
97 } else {
98 die "Unknown line from CLIENT: $line";
99 }
100 },
101 ClientError => sub
102 {
103 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
104 # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
105 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
106
107 # TODO are there other "errors" that is harmless?
108 $error = "Normal disconnection" unless $error;
109 my $msg = "Got SERVER $syscall error $errno: $error";
110 unless ( $syscall eq 'read' and $errno == 0 ) {
111 fail( $msg );
112 } else {
113 diag( $msg ) if $ENV{TEST_VERBOSE};
114 }
115 },
116 );
117
118 POE::Component::Client::TCP->new
119 (
120 Alias => 'myclient',
121 RemoteAddress => '127.0.0.1',
122 RemotePort => $port,
123 Connected => sub
124 {
125 ok(1, 'CLIENT: connected');
126
127 $_[HEAP]->{server}->put("plaintext_ping");
128 },
129 ServerInput => sub
130 {
131 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
132
133 if ( $line eq 'plaintext_pong' ) {
134 ok(1, "CLIENT: recv: $line");
135
136 # sslify it in-situ!
137 my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') };
138 ok(!$@, "CLIENT: SSLify_ContextCreate $@");
139 my $socket = eval { Client_SSLify($heap->{server}->get_output_handle, undef, undef, $ctx) };
140 ok(!$@, "CLIENT: Client_SSLify $@");
141 ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket));
142
143 # We pray that IO::Handle is sane...
144 ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?');
145
146 # TODO evil code here, ha!
147 # Should I ask rcaputo to add a $rw->replace_handle($socket) method?
148 # if you don't do the undef and just replace it - you'll get a bad file descriptor error from POE!
149 # <fh> select error: Bad file descriptor (hits=-1)
150 undef $heap->{server};
151 $heap->{server} = POE::Wheel::ReadWrite->new(
152 Handle => $socket,
153 InputEvent => 'got_server_input',
154 ErrorEvent => 'got_server_error',
155 FlushedEvent => 'got_server_flush',
156 );
157
158 # Send the ssl ping!
159 $heap->{server}->put('ssl_ping');
160 } elsif ( $line eq 'ssl_pong' ) {
161 ok(1, "CLIENT: recv: $line");
162
163 ## At this point, connection MUST be encrypted.
164 my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle);
165 ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher");
166
167 $kernel->yield('shutdown');
168 } else {
169 die "Unknown line from SERVER: $line";
170 }
171 },
172 ServerError => sub
173 {
174 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
175 # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
176 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
177
178 # TODO are there other "errors" that is harmless?
179 $error = "Normal disconnection" unless $error;
180 my $msg = "Got CLIENT $syscall error $errno: $error";
181 unless ( $syscall eq 'read' and $errno == 0 ) {
182 fail( $msg );
183 } else {
184 diag( $msg ) if $ENV{TEST_VERBOSE};
185 }
186 },
187 );
188
189 $poe_kernel->run();
190
191 pass( 'shut down sanely' );
192
193 exit 0;
+0
-211
t/3_renegotiate.t less more
0 #!/usr/bin/perl
1
2 # Thanks to ASCENT for this test!
3
4 # This test adds renegotiation to the connection
5 # Since this is not supported on all platforms, it's marked TODO and adds custom logic
6 # to make sure it doesn't FAIL if it's not supported.
7
8 use strict; use warnings;
9
10 my $numtests;
11 BEGIN {
12 $numtests = 23;
13
14 eval "use Test::NoWarnings";
15 if ( ! $@ ) {
16 # increment by one
17 $numtests++;
18
19 }
20 }
21
22 use Test::More tests => $numtests;
23
24 use POE;
25 use POE::Component::Client::TCP;
26 use POE::Component::Server::TCP;
27 use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate/;
28 use Net::SSLeay qw/ERROR_WANT_READ ERROR_WANT_WRITE/;
29 use POSIX qw/F_GETFL F_SETFL O_NONBLOCK EAGAIN EWOULDBLOCK/;
30
31 # TODO rewrite this to use Test::POE::Server::TCP and stuff :)
32
33 my $port;
34 my $server_ping2;
35 my $client_ping2;
36
37 POE::Component::Server::TCP->new
38 (
39 Alias => 'myserver',
40 Address => '127.0.0.1',
41 Port => 0,
42
43 Started => sub
44 {
45 use Socket qw/sockaddr_in/;
46 $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0];
47 },
48 ClientConnected => sub
49 {
50 ok(1, 'SERVER: accepted');
51 },
52 ClientDisconnected => sub
53 {
54 ok(1, 'SERVER: client disconnected');
55 $_[KERNEL]->post(myserver => 'shutdown');
56 },
57 ClientPreConnect => sub
58 {
59 eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') };
60 eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@);
61 ok(!$@, "SERVER: SSLify_Options $@");
62
63 my $socket = eval { Server_SSLify($_[ARG0]) };
64 ok(!$@, "SERVER: Server_SSLify $@");
65 ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket));
66
67 my $flags = fcntl($_[ARG0], F_GETFL, 0);
68 ok($flags & O_NONBLOCK, 'SERVER: SSLified socket is non-blocking?');
69
70 return ($socket);
71 },
72 ClientInput => sub
73 {
74 my ($kernel, $heap, $request) = @_[KERNEL, HEAP, ARG0];
75
76 ## At this point, connection MUST be encrypted.
77 my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle);
78 ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher");
79
80 if ($request eq 'ping')
81 {
82 ok(1, "SERVER: recv: $request");
83 $heap->{client}->put("pong");
84 }
85 elsif ($request eq 'ping2')
86 {
87 ok(1, "SERVER: recv: $request");
88 $server_ping2++;
89 $heap->{client}->put("pong2");
90 }
91 },
92 ClientError => sub
93 {
94 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
95 # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
96 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
97
98 # TODO are there other "errors" that is harmless?
99 $error = "Normal disconnection" unless $error;
100 my $msg = "Got SERVER $syscall error $errno: $error";
101 unless ( $syscall eq 'read' and $errno == 0 ) {
102 fail( $msg );
103 } else {
104 diag( $msg ) if $ENV{TEST_VERBOSE};
105 }
106 },
107 );
108
109 POE::Component::Client::TCP->new
110 (
111 Alias => 'myclient',
112 RemoteAddress => '127.0.0.1',
113 RemotePort => $port,
114 Connected => sub
115 {
116 ok(1, 'CLIENT: connected');
117
118 $_[HEAP]->{server}->put("ping");
119 },
120 PreConnect => sub
121 {
122 my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') };
123 ok(!$@, "CLIENT: SSLify_ContextCreate $@");
124 my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) };
125 ok(!$@, "CLIENT: Client_SSLify $@");
126 ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket));
127
128 my $flags = fcntl($_[ARG0], F_GETFL, 0);
129 ok($flags & O_NONBLOCK, 'CLIENT: SSLified socket is non-blocking?');
130
131 return ($socket);
132 },
133 ServerInput => sub
134 {
135 my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0];
136
137 ## At this point, connection MUST be encrypted.
138 my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle);
139 ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher");
140
141 if ($line eq 'pong')
142 {
143 ok(1, "CLIENT: recv: $line");
144
145 # Skip 2 Net::SSLeay::renegotiate() tests on FreeBSD because of
146 # http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc
147 TODO: {
148 local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms";
149
150 ## Force SSL renegotiation
151 my $ssl = tied(*{$heap->{server}->get_output_handle})->{ssl};
152 my $reneg_num = Net::SSLeay::num_renegotiations($ssl);
153
154 ok(1 == Net::SSLeay::renegotiate($ssl), 'CLIENT: SSL renegotiation');
155 my $handshake = Net::SSLeay::do_handshake($ssl);
156 my $err = Net::SSLeay::get_error($ssl, $handshake);
157
158 ## 1 == Successful handshake, ERROR_WANT_(READ|WRITE) == non-blocking.
159 ok($handshake == 1 || $err == ERROR_WANT_READ || $err == ERROR_WANT_WRITE, 'CLIENT: SSL handshake');
160 ok($reneg_num < Net::SSLeay::num_renegotiations($ssl), 'CLIENT: Increased number of negotiations');
161 }
162
163 $heap->{server}->put('ping2');
164 }
165
166 elsif ($line eq 'pong2')
167 {
168 ok(1, "CLIENT: recv: $line");
169 $client_ping2++;
170 $kernel->yield('shutdown');
171 }
172 },
173 ServerError => sub
174 {
175 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
176 # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
177 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
178
179 # TODO are there other "errors" that is harmless?
180 $error = "Normal disconnection" unless $error;
181 my $msg = "Got CLIENT $syscall error $errno: $error";
182 unless ( $syscall eq 'read' and $errno == 0 ) {
183 fail( $msg );
184 } else {
185 diag( $msg ) if $ENV{TEST_VERBOSE};
186 }
187 },
188 );
189
190 $poe_kernel->run();
191
192 # Add extra pass() to make the test harness happy if renegotiate did not work
193 if ( ! $server_ping2 ) {
194 local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms";
195 fail( "SERVER: Failed SSL renegotiation" );
196 }
197 if ( ! $client_ping2 ) {
198 local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms";
199 fail( "CLIENT: Failed SSL renegotiation" );
200 }
201 if ( ! $server_ping2 or ! $client_ping2 ) {
202 diag( "WARNING: Your platform/SSL library does not support renegotiation of the SSL socket." );
203 diag( "This test harness detected that trying to renegotiate resulted in a disconnected socket." );
204 diag( "POE::Component::SSLify will work on your system, but please do not attempt a SSL renegotiate." );
205 diag( "Please talk with the author to figure out if this issue can be worked around, thank you!" );
206 }
207
208 pass( 'shut down sanely' );
209
210 exit 0;
+0
-12
t/apocalypse.t less more
0 #!/usr/bin/perl
1 use strict; use warnings;
2
3 use Test::More;
4 eval "use Test::Apocalypse 0.10";
5 if ( $@ ) {
6 plan skip_all => 'Test::Apocalypse required for validating the distribution';
7 } else {
8 # lousy hack for kwalitee
9 require Test::NoWarnings; require Test::Pod; require Test::Pod::Coverage;
10 is_apocalypse_here();
11 }