.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mojo::IOLoop::TLS 3pm" .TH Mojo::IOLoop::TLS 3pm "2019-02-05" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mojo::IOLoop::TLS \- Non\-blocking TLS handshake .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Mojo::IOLoop::TLS; \& \& # Negotiate TLS \& my $tls = Mojo::IOLoop::TLS\->new($old_handle); \& $tls\->on(upgrade => sub { \& my ($tls, $new_handle) = @_; \& ... \& }); \& $tls\->on(error => sub { \& my ($tls, $err) = @_; \& ... \& }); \& $tls\->negotiate(server => 1, tls_version => \*(AqTLSv1_2\*(Aq); \& \& # Start reactor if necessary \& $tls\->reactor\->start unless $tls\->reactor\->is_running; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mojo::IOLoop::TLS negotiates \s-1TLS\s0 for Mojo::IOLoop. .SH "EVENTS" .IX Header "EVENTS" Mojo::IOLoop::TLS inherits all events from Mojo::EventEmitter and can emit the following new ones. .SS "upgrade" .IX Subsection "upgrade" .Vb 4 \& $tls\->on(upgrade => sub { \& my ($tls, $handle) = @_; \& ... \& }); .Ve .PP Emitted once \s-1TLS\s0 has been negotiated. .SS "error" .IX Subsection "error" .Vb 4 \& $tls\->on(error => sub { \& my ($tls, $err) = @_; \& ... \& }); .Ve .PP Emitted if an error occurs during negotiation, fatal if unhandled. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" Mojo::IOLoop::TLS implements the following attributes. .SS "reactor" .IX Subsection "reactor" .Vb 2 \& my $reactor = $tls\->reactor; \& $tls = $tls\->reactor(Mojo::Reactor::Poll\->new); .Ve .PP Low-level event reactor, defaults to the \f(CW\*(C`reactor\*(C'\fR attribute value of the global Mojo::IOLoop singleton. Note that this attribute is weakened. .SH "METHODS" .IX Header "METHODS" Mojo::IOLoop::TLS inherits all methods from Mojo::EventEmitter and implements the following new ones. .SS "can_tls" .IX Subsection "can_tls" .Vb 1 \& my $bool = Mojo::IOLoop::TLS\->can_tls; .Ve .PP True if IO::Socket::SSL 2.009+ is installed and \s-1TLS\s0 support enabled. .SS "negotiate" .IX Subsection "negotiate" .Vb 2 \& $tls\->negotiate(server => 1, tls_version => \*(AqTLSv1_2\*(Aq); \& $tls\->negotiate({server => 1, tls_version => \*(AqTLSv1_2\*(Aq}); .Ve .PP Negotiate \s-1TLS.\s0 .PP These options are currently available: .IP "server" 2 .IX Item "server" .Vb 1 \& server => 1 .Ve .Sp Negotiate \s-1TLS\s0 from the server-side, defaults to the client-side. .IP "tls_ca" 2 .IX Item "tls_ca" .Vb 1 \& tls_ca => \*(Aq/etc/tls/ca.crt\*(Aq .Ve .Sp Path to \s-1TLS\s0 certificate authority file. .IP "tls_cert" 2 .IX Item "tls_cert" .Vb 2 \& tls_cert => \*(Aq/etc/tls/server.crt\*(Aq \& tls_cert => {\*(Aqmojolicious.org\*(Aq => \*(Aq/etc/tls/mojo.crt\*(Aq} .Ve .Sp Path to the \s-1TLS\s0 cert file, defaults to a built-in test certificate on the server-side. .IP "tls_ciphers" 2 .IX Item "tls_ciphers" .Vb 1 \& tls_ciphers => \*(AqAES128\-GCM\-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH\*(Aq .Ve .Sp \&\s-1TLS\s0 cipher specification string. For more information about the format see . .IP "tls_key" 2 .IX Item "tls_key" .Vb 2 \& tls_key => \*(Aq/etc/tls/server.key\*(Aq \& tls_key => {\*(Aqmojolicious.org\*(Aq => \*(Aq/etc/tls/mojo.key\*(Aq} .Ve .Sp Path to the \s-1TLS\s0 key file, defaults to a built-in test key on the server-side. .IP "tls_protocols" 2 .IX Item "tls_protocols" .Vb 1 \& tls_protocols => [\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq] .Ve .Sp \&\s-1ALPN\s0 protocols to negotiate. .IP "tls_verify" 2 .IX Item "tls_verify" .Vb 1 \& tls_verify => 0x00 .Ve .Sp \&\s-1TLS\s0 verification mode. .IP "tls_version" 2 .IX Item "tls_version" .Vb 1 \& tls_version => \*(AqTLSv1_2\*(Aq .Ve .Sp \&\s-1TLS\s0 protocol version. .SS "new" .IX Subsection "new" .Vb 1 \& my $tls = Mojo::IOLoop::TLS\->new($handle); .Ve .PP Construct a new Mojo::IOLoop::Stream object. .SH "SEE ALSO" .IX Header "SEE ALSO" Mojolicious, Mojolicious::Guides, .