Attached patch
--
Paul Evans
=== modified file 'lib/Net/Async/HTTP.pm'
--- lib/Net/Async/HTTP.pm 2018-07-12 14:51:59 +0000
+++ lib/Net/Async/HTTP.pm 2018-09-17 14:15:57 +0000
@@ -691,12 +691,13 @@
my $host = delete $args{host};
my $port = delete $args{port};
my $request = delete $args{request};
+ my $SSL = delete $args{SSL};
my $stall_timeout = $args{stall_timeout} // $self->{stall_timeout};
$self->prepare_request( $request );
- if( $self->{require_SSL} and not $args{SSL} ) {
+ if( $self->{require_SSL} and not $SSL ) {
return Future->fail( "Non-SSL request is not allowed with 'require_SSL' set",
http => undef, $request );
}
@@ -705,9 +706,12 @@
host => $args{proxy_host} || $self->{proxy_host} || $host,
port => $args{proxy_port} || $self->{proxy_port} || $port,
( defined $args{family} ? ( family => $args{family} ) : () ),
- SSL => $args{SSL},
- %{ $self->{ssl_params} },
- ( map { m/^SSL_/ ? ( $_ => $args{$_} ) : () } keys %args ),
+ $SSL ? (
+ SSL => 1,
+ SSL_hostname => $host,
+ %{ $self->{ssl_params} },
+ ( map { m/^SSL_/ ? ( $_ => $args{$_} ) : () } keys %args ),
+ ) : (),
)->then( sub {
my ( $conn ) = @_;
$args{on_ready} ? $args{on_ready}->( $conn )->then_done( $conn )
@@ -719,6 +723,7 @@
request => $request,
stall_timeout => $stall_timeout,
%args,
+ $SSL ? ( SSL => 1 ) : (),
);
} );
}
=== modified file 't/21local-connect-ssl.t'
--- t/21local-connect-ssl.t 2015-07-13 13:31:22 +0000
+++ t/21local-connect-ssl.t 2018-09-17 14:15:57 +0000
@@ -44,6 +44,14 @@
on_stream => sub {
my ( $stream ) = @_;
+ # SNI - RT#94605
+ SKIP: {
+ skip "SSL server does not support SNI", 1 unless IO::Socket::SSL->can_server_sni;
+
+ my $sslsocket = $stream->read_handle;
+ is( $sslsocket->get_servername, "127.0.0.1", '->get_servername on server' );
+ }
+
$stream->configure(
on_read => sub {
my ( $self, $buffref ) = @_;