1Net::Server::Proto::SSLUEsAeYr(3C)ontributed Perl DocumeNnetta:t:iSoenrver::Proto::SSLEAY(3)
2
3
4
6 Net::Server::Proto::SSLEAY - Custom Net::Server SSL protocol handler
7 based on Net::SSLeay.
8
10 See Net::Server::Proto.
11
12 use base qw(Net::Server::HTTP);
13 main->run(
14 proto => 'ssleay',
15 SSL_key_file => "/path/to/my/file.key",
16 SSL_cert_file => "/path/to/my/file.crt",
17 );
18
19
20 # OR
21
22 sub SSL_key_file { "/path/to/my/file.key" }
23 sub SSL_cert_file { "/path/to/my/file.crt" }
24 main->run(proto => 'ssleay');
25
26
27 # OR
28
29 main->run(
30 port => [443, 8443, "80/tcp"], # bind to two ssleay ports and one tcp
31 proto => "ssleay", # use ssleay as the default
32 ipv => "*", # bind both IPv4 and IPv6 interfaces
33 SSL_key_file => "/path/to/my/file.key",
34 SSL_cert_file => "/path/to/my/file.crt",
35 );
36
37
38 # OR
39
40 main->run(port => [{
41 port => "443",
42 proto => "ssleay",
43 # ipv => 4, # default - only do IPv4
44 SSL_key_file => "/path/to/my/file.key",
45 SSL_cert_file => "/path/to/my/file.crt",
46 }, {
47 port => "8443",
48 proto => "ssleay",
49 ipv => "*", # IPv4 and IPv6
50 SSL_key_file => "/path/to/my/file2.key", # separate key
51 SSL_cert_file => "/path/to/my/file2.crt", # separate cert
52 }]);
53
55 This module has reliably been used in situations receiving millions of
56 hits on a single box per day. If anybody has any successes or ideas
57 for improvement under SSLEAY, please email <paul@seamons.com>.
58
59 Protocol module for Net::Server. This module implements a secure
60 socket layer over tcp (also known as SSL). See Net::Server::Proto.
61
62 If you need more customization of the SSL layer, you may want to
63 investigate using SSL rather than SSLEAY as it uses the venerable(ish)
64 IO::Socket::SSL.
65
67 Currently there is support for the following:
68
69 "SSL_cert_file"
70 Full path to the certificate file to be used for this server.
71 Should be in PEM format.
72
73 "SSL_key_file"
74 Full path to the key file to be used for this server. Should be in
75 PEM format.
76
77 "SSL_max_getline_length"
78 Used during getline to only read until this many bytes are found.
79 Default is undef which means unlimited.
80
81 "SSL_error_callback"
82 Should be a code ref that will be called whenever error conditions
83 are encountered. It passes a source message and an arrayref of the
84 errors.
85
87 This module implements most of the common file handle operations.
88 There are some additions though:
89
90 "read_until"
91 Takes bytes and match qr. If bytes is defined - it will read until
92 that many bytes are found. If match qr is defined, it will read
93 until the buffer matches that qr. If both are undefined, it will
94 read until there is nothing left to read.
95
96 "error"
97 If an error occurred while writing, this method will return that
98 error.
99
101 There are probably many.
102
104 Distributed under the same terms as Net::Server
105
107 Thanks to Bilbo at
108 http://devpit.org/wiki/OpenSSL_with_nonblocking_sockets_%28in_Perl%29
109 for documenting a more reliable way of accepting and reading SSL
110 connections.
111
112
113
114perl v5.38.0 2023-07-21 Net::Server::Proto::SSLEAY(3)