GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mojo::IOLoop::TLS(3) User Contributed Perl Documentation Mojo::IOLoop::TLS(3)

Mojo::IOLoop::TLS - Non-blocking TLS handshake

  use Mojo::IOLoop::TLS;

  # Negotiate TLS
  my $tls = Mojo::IOLoop::TLS->new($old_handle);
  $tls->on(upgrade => sub ($tls, $new_handle) {...});
  $tls->on(error => sub ($tls, $err) {...});
  $tls->negotiate(server => 1, tls_version => 'TLSv1_2');

  # Start reactor if necessary
  $tls->reactor->start unless $tls->reactor->is_running;

Mojo::IOLoop::TLS negotiates TLS for Mojo::IOLoop.

Mojo::IOLoop::TLS inherits all events from Mojo::EventEmitter and can emit the following new ones.

  $tls->on(upgrade => sub ($tls, $handle) {...});

Emitted once TLS has been negotiated.

  $tls->on(error => sub ($tls, $err) {...});

Emitted if an error occurs during negotiation, fatal if unhandled.

Mojo::IOLoop::TLS implements the following attributes.

  my $reactor = $tls->reactor;
  $tls        = $tls->reactor(Mojo::Reactor::Poll->new);

Low-level event reactor, defaults to the "reactor" attribute value of the global Mojo::IOLoop singleton. Note that this attribute is weakened.

Mojo::IOLoop::TLS inherits all methods from Mojo::EventEmitter and implements the following new ones.

  my $bool = Mojo::IOLoop::TLS->can_tls;

True if IO::Socket::SSL 2.009+ is installed and TLS support enabled.

  $tls->negotiate(server => 1, tls_version => 'TLSv1_2');
  $tls->negotiate({server => 1, tls_version => 'TLSv1_2'});

Negotiate TLS.

These options are currently available:

server
  server => 1
    

Negotiate TLS from the server-side, defaults to the client-side.

tls_ca
  tls_ca => '/etc/tls/ca.crt'
    

Path to TLS certificate authority file.

tls_cert
  tls_cert => '/etc/tls/server.crt'
  tls_cert => {'mojolicious.org' => '/etc/tls/mojo.crt'}
    

Path to the TLS cert file, defaults to a built-in test certificate on the server-side.

tls_key
  tls_key => '/etc/tls/server.key'
  tls_key => {'mojolicious.org' => '/etc/tls/mojo.key'}
    

Path to the TLS key file, defaults to a built-in test key on the server-side.

tls_options
  tls_options => {SSL_alpn_protocols => ['foo', 'bar'], SSL_verify_mode => 0x00, SSL_version => 'TLSv1_2'}
    

Additional options for IO::Socket::SSL.

  my $tls = Mojo::IOLoop::TLS->new($handle);

Construct a new Mojo::IOLoop::Stream object.

Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
2021-12-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.