--- Slim/Networking/Async/HTTP.pm.original 2017-05-11 17:22:28.000000000 +0100 +++ Slim/Networking/Async/HTTP.pm 2017-05-11 17:16:03.000000000 +0100 @@ -84,7 +84,23 @@ # Create SSL socket if URI is https if ( $self->request->uri->scheme eq 'https' ) { if ( hasSSL() ) { - return Slim::Networking::Async::Socket::HTTPS->new( @_ ); + # We increasingly find servers *requiring* use of the SNI extension to TLS. + # IO::Socket::SSL supports this and, in combination with the Net:HTTPS 'front-end', + # will default to using a server name (PeerAddr || Host || PeerHost). But this will fail + # if PeerAddr has been set to, say, IPv4 or IPv6 address form. And LMS does that through + # DNS lookup. + # So we will probably need to explicitly set "SSL_hostname" if we are to succeed with such + # a server. + + # First, try without explicit SNI, so we don't inadvertently break anything. + # (This is the 'old' behaviour.) (Probably overly conservative.) + my $sock = Slim::Networking::Async::Socket::HTTPS->new( @_ ); + return $sock if $sock; + + # Failed. Try again with an explicit SNI. + my %args = @_; + $args{SSL_hostname} = $args{Host}; + return Slim::Networking::Async::Socket::HTTPS->new( %args ); } else { # change the request to port 80