Hello community,

here is the log from the commit of package perl-Mojolicious for 
openSUSE:Factory checked in at 2017-01-23 11:29:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Mojolicious"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes        
2017-01-15 11:14:39.971399892 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes   
2017-01-23 11:29:29.541069391 +0100
@@ -1,0 +2,21 @@
+Wed Jan 18 11:51:08 UTC 2017 - [email protected]
+
+- updated to 7.20
+   see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+  7.20  2017-01-18
+    - Fixed a bug in Mojo::File where the make_path method would die even if no
+      error occurred.
+    - Fixed warnings in Mojo::IOLoop::TLS.
+
+-------------------------------------------------------------------
+Mon Jan 16 06:08:22 UTC 2017 - [email protected]
+
+- updated to 7.19
+   see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+  7.19  2017-01-14
+    - Added module Mojo::IOLoop::TLS.
+    - Added can_nnr and can_socks methods to Mojo::IOLoop::Client.
+
+-------------------------------------------------------------------

Old:
----
  Mojolicious-7.18.tar.gz

New:
----
  Mojolicious-7.20.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.uhtmK2/_old  2017-01-23 11:29:30.132985471 +0100
+++ /var/tmp/diff_new_pack.uhtmK2/_new  2017-01-23 11:29:30.132985471 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Mojolicious
-Version:        7.18
+Version:        7.20
 Release:        0
 %define cpan_name Mojolicious
 Summary:        Real-time web framework

++++++ Mojolicious-7.18.tar.gz -> Mojolicious-7.20.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/Changes new/Mojolicious-7.20/Changes
--- old/Mojolicious-7.18/Changes        2017-01-11 18:27:26.000000000 +0100
+++ new/Mojolicious-7.20/Changes        2017-01-18 10:29:58.000000000 +0100
@@ -1,4 +1,13 @@
 
+7.20  2017-01-18
+  - Fixed a bug in Mojo::File where the make_path method would die even if no
+    error occurred.
+  - Fixed warnings in Mojo::IOLoop::TLS.
+
+7.19  2017-01-14
+  - Added module Mojo::IOLoop::TLS.
+  - Added can_nnr and can_socks methods to Mojo::IOLoop::Client.
+
 7.18  2017-01-11
   - Fixed support for relative %INC paths in Mojo::Home.
   - Fixed a bug in Mojo::URL where invalid fragment strings could be generated.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/MANIFEST 
new/Mojolicious-7.20/MANIFEST
--- old/Mojolicious-7.18/MANIFEST       2017-01-11 23:04:08.000000000 +0100
+++ new/Mojolicious-7.20/MANIFEST       2017-01-18 10:37:29.000000000 +0100
@@ -39,6 +39,7 @@
 lib/Mojo/IOLoop/Server.pm
 lib/Mojo/IOLoop/Stream.pm
 lib/Mojo/IOLoop/Subprocess.pm
+lib/Mojo/IOLoop/TLS.pm
 lib/Mojo/JSON.pm
 lib/Mojo/JSON/Pointer.pm
 lib/Mojo/Loader.pm
@@ -214,6 +215,7 @@
 t/mojo/templates/exception.mt
 t/mojo/templates/test.mt
 t/mojo/templates/utf8_exception.mt
+t/mojo/tls.t
 t/mojo/transactor.t
 t/mojo/url.t
 t/mojo/user_agent.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/META.json 
new/Mojolicious-7.20/META.json
--- old/Mojolicious-7.18/META.json      2017-01-11 23:04:08.000000000 +0100
+++ new/Mojolicious-7.20/META.json      2017-01-18 10:37:29.000000000 +0100
@@ -58,6 +58,6 @@
       },
       "x_IRC" : "irc://irc.perl.org/#mojo"
    },
-   "version" : "7.18",
+   "version" : "7.20",
    "x_serialization_backend" : "JSON::PP version 2.27400"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/META.yml 
new/Mojolicious-7.20/META.yml
--- old/Mojolicious-7.18/META.yml       2017-01-11 23:04:08.000000000 +0100
+++ new/Mojolicious-7.20/META.yml       2017-01-18 10:37:29.000000000 +0100
@@ -31,5 +31,5 @@
   homepage: http://mojolicious.org
   license: http://www.opensource.org/licenses/artistic-license-2.0
   repository: https://github.com/kraih/mojo.git
-version: '7.18'
+version: '7.20'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/README.md 
new/Mojolicious-7.20/README.md
--- old/Mojolicious-7.18/README.md      2016-08-01 02:04:20.000000000 +0200
+++ new/Mojolicious-7.20/README.md      2017-01-12 00:02:48.000000000 +0100
@@ -1,5 +1,5 @@
 
-# Mojolicious [![Build 
Status](https://travis-ci.org/kraih/mojo.svg?branch=master)](https://travis-ci.org/kraih/mojo)
+# Mojolicious [![Build 
Status](https://travis-ci.org/kraih/mojo.svg?branch=master)](https://travis-ci.org/kraih/mojo)
 [![Windows build 
status](https://ci.appveyor.com/api/projects/status/rf4661uxfjolra2y?svg=true)](https://ci.appveyor.com/project/kraih/mojo)
 
   Back in the early days of the web, many people learned Perl because of a
   wonderful Perl library called [CGI](https://metacpan.org/module/CGI). It was
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/Base.pm 
new/Mojolicious-7.20/lib/Mojo/Base.pm
--- old/Mojolicious-7.18/lib/Mojo/Base.pm       2016-07-19 02:38:18.000000000 
+0200
+++ new/Mojolicious-7.20/lib/Mojo/Base.pm       2017-01-12 13:08:01.000000000 
+0100
@@ -206,9 +206,9 @@
 Create attribute accessors for hash-based objects, an array reference can be
 used to create more than one at a time. Pass an optional second argument to set
 a default value, it should be a constant or a callback. The callback will be
-executed at accessor read time if there's no set value. Accessors can be
-chained, that means they return their invocant when they are called with an
-argument.
+executed at accessor read time if there's no set value, and gets passed the
+current instance of the object as first argument. Accessors can be chained, 
that
+means they return their invocant when they are called with an argument.
 
 =head2 new
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/File.pm 
new/Mojolicious-7.20/lib/Mojo/File.pm
--- old/Mojolicious-7.18/lib/Mojo/File.pm       2017-01-11 09:30:39.000000000 
+0100
+++ new/Mojolicious-7.20/lib/Mojo/File.pm       2017-01-17 18:26:01.000000000 
+0100
@@ -59,8 +59,7 @@
 
 sub make_path {
   my $self = shift;
-  File::Path::make_path $$self, @_
-    or croak qq{Can't make directory "$$self": $!};
+  File::Path::make_path $$self, @_;
   return $self;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/Home.pm 
new/Mojolicious-7.20/lib/Mojo/Home.pm
--- old/Mojolicious-7.18/lib/Mojo/Home.pm       2017-01-11 15:29:33.000000000 
+0100
+++ new/Mojolicious-7.20/lib/Mojo/Home.pm       2017-01-14 12:44:33.000000000 
+0100
@@ -13,7 +13,7 @@
   # Location of the application class (Windows mixes backslash and slash)
   elsif ($class && (my $path = $INC{my $file = class_to_path $class})) {
     $home = Mojo::File->new($path)->to_array;
-    splice @$home, split('/', $file) * -1;
+    splice @$home, (my @dummy = split('/', $file)) * -1;
     pop @$home if @$home && ($home->[-1] eq 'blib' || $home->[-1] eq 'lib');
   }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/IOLoop/Client.pm 
new/Mojolicious-7.20/lib/Mojo/IOLoop/Client.pm
--- old/Mojolicious-7.18/lib/Mojo/IOLoop/Client.pm      2016-10-22 
19:31:42.000000000 +0200
+++ new/Mojolicious-7.20/lib/Mojo/IOLoop/Client.pm      2017-01-15 
17:02:28.000000000 +0100
@@ -4,33 +4,30 @@
 use Errno 'EINPROGRESS';
 use IO::Socket::IP;
 use Mojo::IOLoop;
+use Mojo::IOLoop::TLS;
 use Scalar::Util 'weaken';
 use Socket qw(IPPROTO_TCP SOCK_STREAM TCP_NODELAY);
 
 # Non-blocking name resolution requires Net::DNS::Native
-use constant NDN => $ENV{MOJO_NO_NDN}
+use constant NNR => $ENV{MOJO_NO_NNR}
   ? 0
   : eval 'use Net::DNS::Native 0.15 (); 1';
-my $NDN = NDN ? Net::DNS::Native->new(pool => 5, extra_thread => 1) : undef;
-
-# TLS support requires IO::Socket::SSL
-use constant TLS => $ENV{MOJO_NO_TLS}
-  ? 0
-  : eval 'use IO::Socket::SSL 1.94 (); 1';
-use constant TLS_READ  => TLS ? IO::Socket::SSL::SSL_WANT_READ()  : 0;
-use constant TLS_WRITE => TLS ? IO::Socket::SSL::SSL_WANT_WRITE() : 0;
+my $NDN = NNR ? Net::DNS::Native->new(pool => 5, extra_thread => 1) : undef;
 
 # SOCKS support requires IO::Socket::Socks
 use constant SOCKS => $ENV{MOJO_NO_SOCKS}
   ? 0
   : eval 'use IO::Socket::Socks 0.64 (); 1';
-use constant SOCKS_READ  => SOCKS ? IO::Socket::Socks::SOCKS_WANT_READ()  : 0;
-use constant SOCKS_WRITE => SOCKS ? IO::Socket::Socks::SOCKS_WANT_WRITE() : 0;
+use constant READ  => SOCKS ? IO::Socket::Socks::SOCKS_WANT_READ()  : 0;
+use constant WRITE => SOCKS ? IO::Socket::Socks::SOCKS_WANT_WRITE() : 0;
 
 has reactor => sub { Mojo::IOLoop->singleton->reactor };
 
 sub DESTROY { shift->_cleanup }
 
+sub can_nnr   {NNR}
+sub can_socks {SOCKS}
+
 sub connect {
   my ($self, $args) = (shift, ref $_[0] ? $_[0] : {@_});
 
@@ -44,7 +41,7 @@
   $_ && s/[[\]]//g for @$args{qw(address socks_address)};
   my $address = $args->{socks_address} || ($args->{address} ||= '127.0.0.1');
   return $reactor->next_tick(sub { $self && $self->_connect($args) })
-    if !NDN || $args->{handle};
+    if !NNR || $args->{handle};
 
   # Non-blocking name resolution
   my $handle = $self->{dns} = $NDN->getaddrinfo($address, _port($args),
@@ -86,7 +83,7 @@
   }
   $handle->blocking(0);
 
-  $self->_wait($handle, $args);
+  $self->_wait('_ready', $handle, $args);
 }
 
 sub _port { $_[0]{socks_port} || $_[0]{port} || ($_[0]{tls} ? 443 : 80) }
@@ -99,7 +96,7 @@
   unless ($handle->connect) {
     return $self->emit(error => $!) unless $! == EINPROGRESS;
     $self->reactor->remove($handle);
-    return $self->_wait($handle, $args);
+    return $self->_wait('_ready', $handle, $args);
   }
 
   return $self->emit(error => $! || 'Not connected') unless $handle->connected;
@@ -119,22 +116,9 @@
 
   # Switch between reading and writing
   my $err = $IO::Socket::Socks::SOCKS_ERROR;
-  if    ($err == SOCKS_READ)  { $self->reactor->watch($handle, 1, 0) }
-  elsif ($err == SOCKS_WRITE) { $self->reactor->watch($handle, 1, 1) }
-  else                        { $self->emit(error => $err) }
-}
-
-sub _tls {
-  my $self = shift;
-
-  # Connected
-  my $handle = $self->{handle};
-  return $self->_cleanup->emit(connect => $handle) if $handle->connect_SSL;
-
-  # Switch between reading and writing
-  my $err = $IO::Socket::SSL::SSL_ERROR;
-  if    ($err == TLS_READ)  { $self->reactor->watch($handle, 1, 0) }
-  elsif ($err == TLS_WRITE) { $self->reactor->watch($handle, 1, 1) }
+  if    ($err == READ)  { $self->reactor->watch($handle, 1, 0) }
+  elsif ($err == WRITE) { $self->reactor->watch($handle, 1, 1) }
+  else                  { $self->emit(error => $err) }
 }
 
 sub _try_socks {
@@ -154,8 +138,8 @@
   $reactor->remove($handle);
   return $self->emit(error => 'SOCKS upgrade failed')
     unless IO::Socket::Socks->start_SOCKS($handle, %options);
-  weaken $self;
-  $reactor->io($handle => sub { $self->_socks($args) })->watch($handle, 0, 1);
+
+  $self->_wait('_socks', $handle, $args);
 }
 
 sub _try_tls {
@@ -163,34 +147,20 @@
 
   my $handle = $self->{handle};
   return $self->_cleanup->emit(connect => $handle) unless $args->{tls};
-  return $self->emit(error => 'IO::Socket::SSL 1.94+ required for TLS support')
-    unless TLS;
-
-  # Upgrade
-  weaken $self;
-  my %options = (
-    SSL_ca_file => $args->{tls_ca}
-      && -T $args->{tls_ca} ? $args->{tls_ca} : undef,
-    SSL_cert_file  => $args->{tls_cert},
-    SSL_error_trap => sub { $self->emit(error => $_[1]) },
-    SSL_hostname   => IO::Socket::SSL->can_client_sni ? $args->{address} : '',
-    SSL_key_file   => $args->{tls_key},
-    SSL_startHandshake  => 0,
-    SSL_verify_mode     => $args->{tls_ca} ? 0x01 : 0x00,
-    SSL_verifycn_name   => $args->{address},
-    SSL_verifycn_scheme => $args->{tls_ca} ? 'http' : undef
-  );
   my $reactor = $self->reactor;
   $reactor->remove($handle);
-  return $self->emit(error => 'TLS upgrade failed')
-    unless IO::Socket::SSL->start_SSL($handle, %options);
-  $reactor->io($handle => sub { $self->_tls })->watch($handle, 0, 1);
+
+  # Start TLS handshake
+  my $tls = Mojo::IOLoop::TLS->new($handle)->reactor($self->reactor);
+  $tls->on(upgrade => sub { $self->_cleanup->emit(connect => pop) });
+  $tls->on(error => sub { $self->emit(error => pop) });
+  $tls->negotiate(%$args);
 }
 
 sub _wait {
-  my ($self, $handle, $args) = @_;
+  my ($self, $next, $handle, $args) = @_;
   weaken $self;
-  $self->reactor->io($handle => sub { $self->_ready($args) })
+  $self->reactor->io($handle => sub { $self->$next($args) })
     ->watch($handle, 0, 1);
 }
 
@@ -265,9 +235,23 @@
 L<Mojo::IOLoop::Client> inherits all methods from L<Mojo::EventEmitter> and
 implements the following new ones.
 
+=head2 can_nnr
+
+  my $bool = Mojo::IOLoop::Client->can_nnr;
+
+True if L<Net::DNS::Native> 0.15+ is installed and non-blocking name resolution
+support enabled.
+
+=head2 can_socks
+
+  my $bool = Mojo::IOLoop::Client->can_socks;
+
+True if L<IO::Socket::SOCKS> 0.64+ is installed and SOCKS5 support enabled.
+
 =head2 connect
 
   $client->connect(address => '127.0.0.1', port => 3000);
+  $client->connect({address => '127.0.0.1', port => 3000});
 
 Open a socket connection to a remote host. Note that non-blocking name
 resolution depends on L<Net::DNS::Native> (0.15+), SOCKS5 support on
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/IOLoop/Server.pm 
new/Mojolicious-7.20/lib/Mojo/IOLoop/Server.pm
--- old/Mojolicious-7.18/lib/Mojo/IOLoop/Server.pm      2017-01-09 
18:47:43.000000000 +0100
+++ new/Mojolicious-7.20/lib/Mojo/IOLoop/Server.pm      2017-01-15 
14:11:35.000000000 +0100
@@ -3,31 +3,17 @@
 
 use Carp 'croak';
 use IO::Socket::IP;
-use Mojo::File 'path';
 use Mojo::IOLoop;
+use Mojo::IOLoop::TLS;
 use Scalar::Util 'weaken';
 use Socket qw(IPPROTO_TCP TCP_NODELAY);
 
-# TLS support requires IO::Socket::SSL
-use constant TLS => $ENV{MOJO_NO_TLS}
-  ? 0
-  : eval 'use IO::Socket::SSL 1.94 (); 1';
-use constant TLS_READ  => TLS ? IO::Socket::SSL::SSL_WANT_READ()  : 0;
-use constant TLS_WRITE => TLS ? IO::Socket::SSL::SSL_WANT_WRITE() : 0;
-
-# To regenerate the certificate run this command (18.04.2012)
-# openssl req -new -x509 -keyout server.key -out server.crt -nodes -days 7300
-my $CERT = path(__FILE__)->dirname->child('resources', 
'server.crt')->to_string;
-my $KEY  = path(__FILE__)->dirname->child('resources', 
'server.key')->to_string;
-
 has reactor => sub { Mojo::IOLoop->singleton->reactor };
 
 sub DESTROY {
   my $self = shift;
   $ENV{MOJO_REUSE} =~ s/(?:^|\,)\Q$self->{reuse}\E// if $self->{reuse};
-  return unless my $reactor = $self->reactor;
-  $self->stop if $self->{handle};
-  $reactor->remove($_) for values %{$self->{handles}};
+  $self->stop if $self->{handle} && $self->reactor;
 }
 
 sub generate_port {
@@ -76,28 +62,10 @@
     $ENV{MOJO_REUSE} .= length $ENV{MOJO_REUSE} ? ",$reuse" : "$reuse";
   }
   $handle->blocking(0);
-  @$self{qw(handle single_accept)} = ($handle, $args->{single_accept});
-
-  return unless $args->{tls};
-  croak "IO::Socket::SSL 1.94+ required for TLS support" unless TLS;
+  @$self{qw(args handle)} = ($args, $handle);
 
-  weaken $self;
-  my $tls = $self->{tls} = {
-    SSL_cert_file => $args->{tls_cert} || $CERT,
-    SSL_error_trap => sub {
-      return unless my $handle = delete $self->{handles}{shift()};
-      $self->reactor->remove($handle);
-      close $handle;
-    },
-    SSL_honor_cipher_order => 1,
-    SSL_key_file           => $args->{tls_key} || $KEY,
-    SSL_startHandshake     => 0,
-    SSL_verify_mode => $args->{tls_verify} // ($args->{tls_ca} ? 0x03 : 0x00)
-  };
-  $tls->{SSL_ca_file} = $args->{tls_ca}
-    if $args->{tls_ca} && -T $args->{tls_ca};
-  $tls->{SSL_cipher_list} = $args->{tls_ciphers} if $args->{tls_ciphers};
-  $tls->{SSL_version}     = $args->{tls_version} if $args->{tls_version};
+  croak 'IO::Socket::SSL 1.94+ required for TLS support'
+    if !Mojo::IOLoop::TLS->can_tls && $args->{tls};
 }
 
 sub port { shift->{handle}->sockport }
@@ -115,40 +83,23 @@
   my $self = shift;
 
   # Greedy accept
+  my $args     = $self->{args};
   my $accepted = 0;
-  while ($self->{active} && !($self->{single_accept} && $accepted++)) {
+  while ($self->{active} && !($args->{single_accept} && $accepted++)) {
     return unless my $handle = $self->{handle}->accept;
     $handle->blocking(0);
 
     # Disable Nagle's algorithm
     setsockopt $handle, IPPROTO_TCP, TCP_NODELAY, 1;
 
-    # Start TLS handshake
-    $self->emit(accept => $handle) and next unless my $tls = $self->{tls};
-    $self->_handshake($self->{handles}{$handle} = $handle)
-      if $handle = IO::Socket::SSL->start_SSL($handle, %$tls, SSL_server => 1);
-  }
-}
-
-sub _handshake {
-  my ($self, $handle) = @_;
-  weaken $self;
-  $self->reactor->io($handle => sub { $self->_tls($handle) });
-}
-
-sub _tls {
-  my ($self, $handle) = @_;
+    $self->emit(accept => $handle) and next unless $args->{tls};
 
-  # Accepted
-  if ($handle->accept_SSL) {
-    $self->reactor->remove($handle);
-    return $self->emit(accept => delete $self->{handles}{$handle});
+    # Start TLS handshake
+    my $tls = Mojo::IOLoop::TLS->new($handle)->reactor($self->reactor);
+    $tls->on(upgrade => sub { $self->emit(accept => pop) });
+    $tls->on(error => sub { });
+    $tls->negotiate(%$args, server => 1);
   }
-
-  # Switch between reading and writing
-  my $err = $IO::Socket::SSL::SSL_ERROR;
-  if    ($err == TLS_READ)  { $self->reactor->watch($handle, 1, 0) }
-  elsif ($err == TLS_WRITE) { $self->reactor->watch($handle, 1, 1) }
 }
 
 1;
@@ -215,7 +166,7 @@
 
 =head2 generate_port
 
-  my $port = $server->generate_port;
+  my $port = Mojo::IOLoop::Server->generate_port;
 
 Find a free TCP port, primarily used for tests.
 
@@ -234,6 +185,7 @@
 =head2 listen
 
   $server->listen(port => 3000);
+  $server->listen({port => 3000});
 
 Create a new listen socket. Note that TLS support depends on L<IO::Socket::SSL>
 (1.94+).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/IOLoop/TLS.pm 
new/Mojolicious-7.20/lib/Mojo/IOLoop/TLS.pm
--- old/Mojolicious-7.18/lib/Mojo/IOLoop/TLS.pm 1970-01-01 01:00:00.000000000 
+0100
+++ new/Mojolicious-7.20/lib/Mojo/IOLoop/TLS.pm 2017-01-18 10:35:53.000000000 
+0100
@@ -0,0 +1,242 @@
+package Mojo::IOLoop::TLS;
+use Mojo::Base 'Mojo::EventEmitter';
+
+use Mojo::File 'path';
+use Mojo::IOLoop;
+use Scalar::Util 'weaken';
+
+# TLS support requires IO::Socket::SSL
+use constant TLS => $ENV{MOJO_NO_TLS}
+  ? 0
+  : eval 'use IO::Socket::SSL 1.94 (); 1';
+use constant READ  => TLS ? IO::Socket::SSL::SSL_WANT_READ()  : 0;
+use constant WRITE => TLS ? IO::Socket::SSL::SSL_WANT_WRITE() : 0;
+
+has reactor => sub { Mojo::IOLoop->singleton->reactor };
+
+# To regenerate the certificate run this command (18.04.2012)
+# openssl req -new -x509 -keyout server.key -out server.crt -nodes -days 7300
+my $CERT = path(__FILE__)->dirname->child('resources', 
'server.crt')->to_string;
+my $KEY  = path(__FILE__)->dirname->child('resources', 
'server.key')->to_string;
+
+sub DESTROY { shift->_cleanup }
+
+sub can_tls {TLS}
+
+sub negotiate {
+  my ($self, $args) = (shift, ref $_[0] ? $_[0] : {@_});
+
+  return $self->emit(error => 'IO::Socket::SSL 1.94+ required for TLS support')
+    unless TLS;
+
+  my $handle = $self->{handle};
+  return $self->emit(error => $IO::Socket::SSL::SSL_ERROR)
+    unless IO::Socket::SSL->start_SSL($handle, %{$self->_expand($args)});
+  $self->reactor->io($handle
+      = $handle => sub { $self->_tls($handle, $args->{server}) });
+}
+
+sub new { shift->SUPER::new(handle => shift) }
+
+sub _cleanup {
+  my $self = shift;
+  return unless my $reactor = $self->reactor;
+  $reactor->remove($self->{handle}) if $self->{handle};
+  return $self;
+}
+
+sub _expand {
+  my ($self, $args) = @_;
+
+  weaken $self;
+  my $tls = {
+    SSL_ca_file => $args->{tls_ca}
+      && -T $args->{tls_ca} ? $args->{tls_ca} : undef,
+    SSL_error_trap         => sub { $self->_cleanup->emit(error => $_[1]) },
+    SSL_honor_cipher_order => 1,
+    SSL_startHandshake     => 0
+  };
+  $tls->{SSL_cert_file}   = $args->{tls_cert}    if $args->{tls_cert};
+  $tls->{SSL_cipher_list} = $args->{tls_ciphers} if $args->{tls_ciphers};
+  $tls->{SSL_key_file}    = $args->{tls_key}     if $args->{tls_key};
+  $tls->{SSL_server}      = $args->{server}      if $args->{server};
+  $tls->{SSL_verify_mode} = $args->{tls_verify}  if exists $args->{tls_verify};
+  $tls->{SSL_version}     = $args->{tls_version} if $args->{tls_version};
+
+  if ($args->{server}) {
+    $tls->{SSL_cert_file} ||= $CERT;
+    $tls->{SSL_key_file}  ||= $KEY;
+    $tls->{SSL_verify_mode} //= $args->{tls_ca} ? 0x03 : 0x00;
+  }
+  else {
+    $tls->{SSL_hostname}
+      = IO::Socket::SSL->can_client_sni ? $args->{address} : '';
+    $tls->{SSL_verifycn_scheme} = $args->{tls_ca} ? 'http' : undef;
+    $tls->{SSL_verify_mode} //= $args->{tls_ca} ? 0x01 : 0x00;
+    $tls->{SSL_verifycn_name} = $args->{address};
+  }
+
+  return $tls;
+}
+
+sub _tls {
+  my ($self, $handle, $server) = @_;
+
+  return $self->emit(upgrade => delete $self->{handle})
+    if $server ? $handle->accept_SSL : $handle->connect_SSL;
+
+  # Switch between reading and writing
+  my $err = $IO::Socket::SSL::SSL_ERROR;
+  if    ($err == READ)  { $self->reactor->watch($handle, 1, 0) }
+  elsif ($err == WRITE) { $self->reactor->watch($handle, 1, 1) }
+}
+
+1;
+
+=encoding utf8
+
+=head1 NAME
+
+Mojo::IOLoop::TLS - Non-blocking TLS handshake
+
+=head1 SYNOPSIS
+
+  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 => 'TLSv1_2');
+
+  # Start reactor if necessary
+  $tls->reactor->start unless $tls->reactor->is_running;
+
+=head1 DESCRIPTION
+
+L<Mojo::IOLoop::TLS> negotiates TLS for L<Mojo::IOLoop>.
+
+=head1 EVENTS
+
+L<Mojo::IOLoop::TLS> inherits all events from L<Mojo::EventEmitter> and can
+emit the following new ones.
+
+=head2 upgrade
+
+  $tls->on(upgrade => sub {
+    my ($tls, $handle) = @_;
+    ...
+  });
+
+Emitted once TLS has been negotiated.
+
+=head2 error
+
+  $tls->on(error => sub {
+    my ($tls, $err) = @_;
+    ...
+  });
+
+Emitted if an error occurs during negotiation, fatal if unhandled.
+
+=head1 ATTRIBUTES
+
+L<Mojo::IOLoop::TLS> implements the following attributes.
+
+=head2 reactor
+
+  my $reactor = $tls->reactor;
+  $tls        = $tls->reactor(Mojo::Reactor::Poll->new);
+
+Low-level event reactor, defaults to the C<reactor> attribute value of the
+global L<Mojo::IOLoop> singleton.
+
+=head1 METHODS
+
+L<Mojo::IOLoop::TLS> inherits all methods from L<Mojo::EventEmitter> and
+implements the following new ones.
+
+=head2 can_tls
+
+  my $bool = Mojo::IOLoop::TLS->can_tls;
+
+True if L<IO::Socket::SSL> 1.94+ is installed and TLS support enabled.
+
+=head2 negotiate
+
+  $tls->negotiate(server => 1, tls_version => 'TLSv1_2');
+  $tls->negotiate({server => 1, tls_version => 'TLSv1_2'});
+
+Negotiate TLS.
+
+These options are currently available:
+
+=over 2
+
+=item server
+
+  server => 1
+
+Negotiate TLS from the server-side, defaults to the client-side.
+
+=item tls_ca
+
+  tls_ca => '/etc/tls/ca.crt'
+
+Path to TLS certificate authority file. Also activates hostname verification on
+the client-side.
+
+=item 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.
+
+=item tls_ciphers
+
+  tls_ciphers => 'AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH'
+
+TLS cipher specification string. For more information about the format see
+L<https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-STRINGS>.
+
+=item 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.
+
+=item tls_verify
+
+  tls_verify => 0x00
+
+TLS verification mode, defaults to C<0x03> on the server-side and C<0x01> on 
the
+client-side if a certificate authority file has been provided, or C<0x00>.
+
+=item tls_version
+
+  tls_version => 'TLSv1_2'
+
+TLS protocol version.
+
+=back
+
+=head2 new
+
+  my $tls = Mojo::IOLoop::TLS->new($handle);
+
+Construct a new L<Mojo::IOLoop::Stream> object.
+
+=head1 SEE ALSO
+
+L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicious.org>.
+
+=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/IOLoop.pm 
new/Mojolicious-7.20/lib/Mojo/IOLoop.pm
--- old/Mojolicious-7.18/lib/Mojo/IOLoop.pm     2016-12-18 02:15:11.000000000 
+0100
+++ new/Mojolicious-7.20/lib/Mojo/IOLoop.pm     2017-01-15 17:02:28.000000000 
+0100
@@ -304,7 +304,7 @@
 resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
 L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
 L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
-features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
+features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
 C<MOJO_NO_TLS> environment variables.
 
 See L<Mojolicious::Guides::Cookbook/"REAL-TIME WEB"> for more.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/Server/Daemon.pm 
new/Mojolicious-7.20/lib/Mojo/Server/Daemon.pm
--- old/Mojolicious-7.18/lib/Mojo/Server/Daemon.pm      2016-11-29 
17:34:10.000000000 +0100
+++ new/Mojolicious-7.20/lib/Mojo/Server/Daemon.pm      2017-01-15 
17:02:28.000000000 +0100
@@ -279,7 +279,7 @@
 resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
 L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
 L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
-features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
+features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
 C<MOJO_NO_TLS> environment variables.
 
 See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/Server/Hypnotoad.pm 
new/Mojolicious-7.20/lib/Mojo/Server/Hypnotoad.pm
--- old/Mojolicious-7.18/lib/Mojo/Server/Hypnotoad.pm   2017-01-09 
18:47:43.000000000 +0100
+++ new/Mojolicious-7.20/lib/Mojo/Server/Hypnotoad.pm   2017-01-15 
17:02:28.000000000 +0100
@@ -185,7 +185,7 @@
 resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
 L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
 L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
-features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
+features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
 C<MOJO_NO_TLS> environment variables.
 
 See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/Server/Morbo.pm 
new/Mojolicious-7.20/lib/Mojo/Server/Morbo.pm
--- old/Mojolicious-7.18/lib/Mojo/Server/Morbo.pm       2017-01-10 
11:39:58.000000000 +0100
+++ new/Mojolicious-7.20/lib/Mojo/Server/Morbo.pm       2017-01-15 
17:02:28.000000000 +0100
@@ -116,7 +116,7 @@
 resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
 L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
 L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
-features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
+features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
 C<MOJO_NO_TLS> environment variables.
 
 See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/Server/Prefork.pm 
new/Mojolicious-7.20/lib/Mojo/Server/Prefork.pm
--- old/Mojolicious-7.18/lib/Mojo/Server/Prefork.pm     2017-01-09 
23:48:27.000000000 +0100
+++ new/Mojolicious-7.20/lib/Mojo/Server/Prefork.pm     2017-01-15 
17:02:28.000000000 +0100
@@ -234,7 +234,7 @@
 resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
 L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
 L<IO::Socket::SSL> (1.84+) will be used automatically if possible. Individual
-features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
+features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
 C<MOJO_NO_TLS> environment variables.
 
 See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojo/UserAgent.pm 
new/Mojolicious-7.20/lib/Mojo/UserAgent.pm
--- old/Mojolicious-7.18/lib/Mojo/UserAgent.pm  2016-12-29 20:51:55.000000000 
+0100
+++ new/Mojolicious-7.20/lib/Mojo/UserAgent.pm  2017-01-15 17:02:28.000000000 
+0100
@@ -434,7 +434,7 @@
 resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
 L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
 L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
-features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
+features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
 C<MOJO_NO_TLS> environment variables.
 
 See L<Mojolicious::Guides::Cookbook/"USER AGENT"> for more.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojolicious/Command/version.pm 
new/Mojolicious-7.20/lib/Mojolicious/Command/version.pm
--- old/Mojolicious-7.18/lib/Mojolicious/Command/version.pm     2016-07-19 
02:38:18.000000000 +0200
+++ new/Mojolicious-7.20/lib/Mojolicious/Command/version.pm     2017-01-15 
17:02:28.000000000 +0100
@@ -2,6 +2,7 @@
 use Mojo::Base 'Mojolicious::Command';
 
 use Mojo::IOLoop::Client;
+use Mojo::IOLoop::TLS;
 use Mojolicious;
 
 has description => 'Show versions of available modules';
@@ -10,11 +11,11 @@
 sub run {
   my $self = shift;
 
-  my $ev    = eval 'use Mojo::Reactor::EV; 1' ? $EV::VERSION : 'n/a';
-  my $class = 'Mojo::IOLoop::Client';
-  my $socks = $class->SOCKS ? $IO::Socket::Socks::VERSION : 'n/a';
-  my $tls   = $class->TLS ? $IO::Socket::SSL::VERSION : 'n/a';
-  my $ndn   = $class->NDN ? $Net::DNS::Native::VERSION : 'n/a';
+  my $ev = eval 'use Mojo::Reactor::EV; 1' ? $EV::VERSION : 'n/a';
+  my $socks
+    = Mojo::IOLoop::Client->can_socks ? $IO::Socket::Socks::VERSION : 'n/a';
+  my $tls = Mojo::IOLoop::TLS->can_tls    ? $IO::Socket::SSL::VERSION  : 'n/a';
+  my $nnr = Mojo::IOLoop::Client->can_nnr ? $Net::DNS::Native::VERSION : 'n/a';
 
   print <<EOF;
 CORE
@@ -25,7 +26,7 @@
   EV 4.0+                 ($ev)
   IO::Socket::Socks 0.64+ ($socks)
   IO::Socket::SSL 1.94+   ($tls)
-  Net::DNS::Native 0.15+  ($ndn)
+  Net::DNS::Native 0.15+  ($nnr)
 
 EOF
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojolicious/Guides.pod 
new/Mojolicious-7.20/lib/Mojolicious/Guides.pod
--- old/Mojolicious-7.18/lib/Mojolicious/Guides.pod     2017-01-09 
18:47:43.000000000 +0100
+++ new/Mojolicious-7.20/lib/Mojolicious/Guides.pod     2017-01-14 
12:44:39.000000000 +0100
@@ -257,6 +257,8 @@
 
 =item * L<Mojo::IOLoop::Stream>
 
+=item * L<Mojo::IOLoop::TLS>
+
 =item * L<Mojo::Log>
 
 =item * L<Mojo::Message>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/lib/Mojolicious.pm 
new/Mojolicious-7.20/lib/Mojolicious.pm
--- old/Mojolicious-7.18/lib/Mojolicious.pm     2017-01-11 09:35:02.000000000 
+0100
+++ new/Mojolicious-7.20/lib/Mojolicious.pm     2017-01-15 17:05:21.000000000 
+0100
@@ -57,7 +57,7 @@
 has validator => sub { Mojolicious::Validator->new };
 
 our $CODENAME = 'Doughnut';
-our $VERSION  = '7.18';
+our $VERSION  = '7.20';
 
 sub AUTOLOAD {
   my $self = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/daemon.t 
new/Mojolicious-7.20/t/mojo/daemon.t
--- old/Mojolicious-7.18/t/mojo/daemon.t        2017-01-09 18:47:43.000000000 
+0100
+++ new/Mojolicious-7.20/t/mojo/daemon.t        2017-01-15 14:11:31.000000000 
+0100
@@ -1,6 +1,9 @@
 use Mojo::Base -strict;
 
-BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
+BEGIN {
+  $ENV{MOJO_NO_TLS}  = 1;
+  $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
+}
 
 use Test::More;
 use FindBin;
@@ -323,6 +326,13 @@
 is $tx->res->code, 200,         'right status';
 is $tx->res->body, 'Whatever!', 'right content';
 
+# No TLS support
+eval {
+  Mojo::Server::Daemon->new(listen => ['https://127.0.0.1'], silent => 1)
+    ->start;
+};
+like $@, qr/IO::Socket::SSL/, 'right error';
+
 # Abstract methods
 eval { Mojo::Server->run };
 like $@, qr/Method "run" not implemented by subclass/, 'right error';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/daemon_ipv6_tls.t 
new/Mojolicious-7.20/t/mojo/daemon_ipv6_tls.t
--- old/Mojolicious-7.18/t/mojo/daemon_ipv6_tls.t       2016-08-12 
11:18:36.000000000 +0200
+++ new/Mojolicious-7.20/t/mojo/daemon_ipv6_tls.t       2017-01-15 
14:00:47.000000000 +0100
@@ -3,14 +3,14 @@
 BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
 
 use Test::More;
-use Mojo::IOLoop::Server;
+use Mojo::IOLoop::TLS;
 
 plan skip_all => 'set TEST_IPV6 to enable this test (developer only!)'
   unless $ENV{TEST_IPV6};
 plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
   unless $ENV{TEST_TLS};
 plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
-  unless Mojo::IOLoop::Server::TLS;
+  unless Mojo::IOLoop::TLS->can_tls;
 
 # To regenerate all required certificates run these commands (07.01.2016)
 # openssl genrsa -out domain.key 1024
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/ioloop_tls.t 
new/Mojolicious-7.20/t/mojo/ioloop_tls.t
--- old/Mojolicious-7.18/t/mojo/ioloop_tls.t    2016-07-19 02:38:18.000000000 
+0200
+++ new/Mojolicious-7.20/t/mojo/ioloop_tls.t    2017-01-15 14:01:00.000000000 
+0100
@@ -3,12 +3,12 @@
 BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
 
 use Test::More;
-use Mojo::IOLoop::Server;
+use Mojo::IOLoop::TLS;
 
 plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
   unless $ENV{TEST_TLS};
 plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
-  unless Mojo::IOLoop::Server::TLS;
+  unless Mojo::IOLoop::TLS->can_tls;
 
 # To regenerate all required certificates run these commands (12.12.2014)
 # openssl genrsa -out ca.key 1024
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/tls.t 
new/Mojolicious-7.20/t/mojo/tls.t
--- old/Mojolicious-7.18/t/mojo/tls.t   1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-7.20/t/mojo/tls.t   2017-01-15 14:01:09.000000000 +0100
@@ -0,0 +1,59 @@
+use Mojo::Base -strict;
+
+BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
+
+use Test::More;
+use Mojo::IOLoop::TLS;
+
+plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
+  unless $ENV{TEST_TLS};
+plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
+  unless Mojo::IOLoop::TLS->can_tls;
+
+use Mojo::IOLoop;
+use Socket;
+
+# Built-in certificate
+socketpair(my $client_sock, my $server_sock, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
+  or die "Couldn't create socket pair: $!";
+$client_sock->blocking(0);
+$server_sock->blocking(0);
+my $delay  = Mojo::IOLoop->delay;
+my $server = Mojo::IOLoop::TLS->new($server_sock);
+$server->once(upgrade => $delay->begin);
+$server->once(error => sub { warn pop });
+$server->negotiate({server => 1});
+my $client = Mojo::IOLoop::TLS->new($client_sock);
+$client->once(upgrade => $delay->begin);
+$client->once(error => sub { warn pop });
+$client->negotiate;
+my ($client_result, $server_result);
+$delay->on(finish => sub { (undef, $server_result, $client_result) = @_ });
+$delay->wait;
+is ref $client_result, 'IO::Socket::SSL', 'right class';
+is ref $server_result, 'IO::Socket::SSL', 'right class';
+
+# Built-in certificate (custom event loop and cipher)
+my $loop = Mojo::IOLoop->new;
+socketpair($client_sock, $server_sock, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
+  or die "Couldn't create socket pair: $!";
+$client_sock->blocking(0);
+$server_sock->blocking(0);
+$delay  = $loop->delay;
+$server = Mojo::IOLoop::TLS->new($server_sock)->reactor($loop->reactor);
+$server->once(upgrade => $delay->begin);
+$server->once(error => sub { warn pop });
+$server->negotiate(server => 1, tls_ciphers => 'AES256-SHA:ALL');
+$client = Mojo::IOLoop::TLS->new($client_sock)->reactor($loop->reactor);
+$client->once(upgrade => $delay->begin);
+$client->once(error => sub { warn pop });
+$client->negotiate;
+$client_result = $server_result = undef;
+$delay->on(finish => sub { (undef, $server_result, $client_result) = @_ });
+$delay->wait;
+is ref $client_result, 'IO::Socket::SSL', 'right class';
+is $client_result->get_cipher, 'AES256-SHA', 'AES256-SHA has been negotiatied';
+is ref $server_result, 'IO::Socket::SSL', 'right class';
+is $server_result->get_cipher, 'AES256-SHA', 'AES256-SHA has been negotiatied';
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/user_agent.t 
new/Mojolicious-7.20/t/mojo/user_agent.t
--- old/Mojolicious-7.18/t/mojo/user_agent.t    2016-12-21 00:36:50.000000000 
+0100
+++ new/Mojolicious-7.20/t/mojo/user_agent.t    2017-01-15 17:02:28.000000000 
+0100
@@ -1,7 +1,7 @@
 use Mojo::Base -strict;
 
 BEGIN {
-  $ENV{MOJO_NO_SOCKS} = $ENV{MOJO_NO_TLS} = 1;
+  $ENV{MOJO_NO_NNR} = $ENV{MOJO_NO_SOCKS} = $ENV{MOJO_NO_TLS} = 1;
   $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
 }
 
@@ -138,11 +138,16 @@
 $tx->req->proxy($ua->server->url->scheme('socks'));
 $tx = $ua->start($tx);
 like $tx->error->{message}, qr/IO::Socket::Socks/, 'right error';
+ok !Mojo::IOLoop::Client->can_socks, 'no SOCKS5 support';
 
 # HTTPS request without TLS support
 $ua = Mojo::UserAgent->new;
 $tx = $ua->get($ua->server->url->scheme('https'));
 like $tx->error->{message}, qr/IO::Socket::SSL/, 'right error';
+ok !Mojo::IOLoop::TLS->can_tls, 'no TLS support';
+
+# No non-blocking name resolution
+ok !Mojo::IOLoop::Client->can_nnr, 'no non-blocking name resolution support';
 
 # Blocking
 $tx = $ua->get('/');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/user_agent_online.t 
new/Mojolicious-7.20/t/mojo/user_agent_online.t
--- old/Mojolicious-7.18/t/mojo/user_agent_online.t     2016-09-17 
15:11:29.000000000 +0200
+++ new/Mojolicious-7.20/t/mojo/user_agent_online.t     2017-01-15 
14:01:18.000000000 +0100
@@ -6,12 +6,12 @@
 }
 
 use Test::More;
-use Mojo::IOLoop::Server;
+use Mojo::IOLoop::TLS;
 
 plan skip_all => 'set TEST_ONLINE to enable this test (developer only!)'
   unless $ENV{TEST_ONLINE};
 plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
-  unless Mojo::IOLoop::Server::TLS;
+  unless Mojo::IOLoop::TLS->can_tls;
 
 use IO::Socket::INET;
 use Mojo::IOLoop;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/user_agent_socks.t 
new/Mojolicious-7.20/t/mojo/user_agent_socks.t
--- old/Mojolicious-7.18/t/mojo/user_agent_socks.t      2016-10-22 
19:26:08.000000000 +0200
+++ new/Mojolicious-7.20/t/mojo/user_agent_socks.t      2017-01-15 
14:01:43.000000000 +0100
@@ -4,13 +4,14 @@
 
 use Test::More;
 use Mojo::IOLoop::Client;
+use Mojo::IOLoop::TLS;
 
 plan skip_all => 'set TEST_SOCKS to enable this test (developer only!)'
   unless $ENV{TEST_SOCKS};
 plan skip_all => 'IO::Socket::Socks 0.64+ required for this test!'
-  unless Mojo::IOLoop::Client::SOCKS;
+  unless Mojo::IOLoop::Client->can_socks;
 plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
-  unless Mojo::IOLoop::Server::TLS;
+  unless Mojo::IOLoop::TLS->can_tls;
 
 use Mojo::IOLoop;
 use Mojo::IOLoop::Server;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/user_agent_tls.t 
new/Mojolicious-7.20/t/mojo/user_agent_tls.t
--- old/Mojolicious-7.18/t/mojo/user_agent_tls.t        2016-08-12 
11:27:37.000000000 +0200
+++ new/Mojolicious-7.20/t/mojo/user_agent_tls.t        2017-01-15 
14:01:51.000000000 +0100
@@ -3,12 +3,12 @@
 BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
 
 use Test::More;
-use Mojo::IOLoop::Server;
+use Mojo::IOLoop::TLS;
 
 plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
   unless $ENV{TEST_TLS};
 plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
-  unless Mojo::IOLoop::Server::TLS;
+  unless Mojo::IOLoop::TLS->can_tls;
 
 use Mojo::IOLoop;
 use Mojo::Server::Daemon;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojo/websocket_proxy_tls.t 
new/Mojolicious-7.20/t/mojo/websocket_proxy_tls.t
--- old/Mojolicious-7.18/t/mojo/websocket_proxy_tls.t   2016-10-16 
11:29:33.000000000 +0200
+++ new/Mojolicious-7.20/t/mojo/websocket_proxy_tls.t   2017-01-15 
14:01:58.000000000 +0100
@@ -3,12 +3,12 @@
 BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
 
 use Test::More;
-use Mojo::IOLoop::Server;
+use Mojo::IOLoop::TLS;
 
 plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
   unless $ENV{TEST_TLS};
 plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
-  unless Mojo::IOLoop::Server::TLS;
+  unless Mojo::IOLoop::TLS->can_tls;
 
 use Mojo::IOLoop;
 use Mojo::Server::Daemon;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-7.18/t/mojolicious/tls_lite_app.t 
new/Mojolicious-7.20/t/mojolicious/tls_lite_app.t
--- old/Mojolicious-7.18/t/mojolicious/tls_lite_app.t   2016-07-19 
02:38:18.000000000 +0200
+++ new/Mojolicious-7.20/t/mojolicious/tls_lite_app.t   2017-01-15 
14:02:06.000000000 +0100
@@ -3,12 +3,12 @@
 BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
 
 use Test::More;
-use Mojo::IOLoop::Server;
+use Mojo::IOLoop::TLS;
 
 plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
   unless $ENV{TEST_TLS};
 plan skip_all => 'IO::Socket::SSL 1.94+ required for this test!'
-  unless Mojo::IOLoop::Server::TLS;
+  unless Mojo::IOLoop::TLS->can_tls;
 
 use Mojo::IOLoop;
 use Mojo::UserAgent;


Reply via email to