Skip Menu |

This queue is for tickets about the Net-Async-HTTP CPAN distribution.

Report information
The Basics
Id: 94605
Status: resolved
Priority: 0/
Queue: Net-Async-HTTP

People
Owner: Nobody in particular
Requestors: kiyoshi.aman [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.34
Fixed in: 0.43



Subject: TLS SNI support
NaHTTP presently does not seem to support SNI. Attempting to connect to resources which support it will produce a 403 error. Reproducing this issue may be done via running Apache with SSLStrictSNIVHostCheck On.
Attached patch -- Paul Evans
Subject: rt94605.patch
=== 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 ) = @_;
Released in 0.43 -- Paul Evans