Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.35
Fixed in: 0.36



Subject: Allow setting SSL params on NaHTTP object
Passing extra SSL_* params as do_request/GET/etc.. method params works nicely: $http->GET( $URL, SSL_verify_mode => ... ) Would be nice if you could $http->configure( SSL_verify_mode => ... ) additionally. Also document these. -- Paul Evans
Patched -- Paul Evans
Subject: rt98514.patch
=== modified file 'lib/Net/Async/HTTP.pm' --- lib/Net/Async/HTTP.pm 2014-10-14 10:04:51 +0000 +++ lib/Net/Async/HTTP.pm 2014-10-14 10:17:32 +0000 @@ -148,6 +148,8 @@ $self->{write_len} = WRITE_LEN; $self->{max_connections_per_host} = 1; + + $self->{ssl_params} = {}; } =head1 PARAMETERS @@ -263,6 +265,12 @@ default to true in a later version. Applications which care which behaviour applies should set this to a defined value to ensure it doesn't change. +=item SSL_* + +Additionally, any parameters whose names start with C<SSL_> will be stored and +passed on requests to perform SSL requests. This simplifies configuration of +common SSL parameters. + =back =cut @@ -280,6 +288,10 @@ $self->{$_} = delete $params{$_} if exists $params{$_}; } + foreach ( grep { m/^SSL_/ } keys %params ) { + $self->{ssl_params}{$_} = delete $params{$_}; + } + if( exists $params{ip_tos} ) { # TODO: This conversion should live in IO::Async somewhere my $ip_tos = delete $params{ip_tos}; @@ -615,6 +627,7 @@ host => $args{proxy_host} || $self->{proxy_host} || $host, port => $args{proxy_port} || $self->{proxy_port} || $port, SSL => $args{SSL}, + %{ $self->{ssl_params} }, ( map { m/^SSL_/ ? ( $_ => $args{$_} ) : () } keys %args ), )->then( sub { my ( $conn ) = @_; === modified file 't/21local-connect-ssl.t' --- t/21local-connect-ssl.t 2013-09-10 00:28:12 +0000 +++ t/21local-connect-ssl.t 2014-10-14 10:17:32 +0000 @@ -21,6 +21,9 @@ my $http = Net::Async::HTTP->new( user_agent => "", # Don't put one in request headers + + # This also checks that object-wide SSL params are applied + SSL_verify_mode => 0, ); $loop->add( $http ); @@ -75,8 +78,6 @@ $http->do_request( uri => $local_uri, - SSL_verify_mode => 0, - on_response => sub { $response = $_[0]; },
Resolved -- Paul Evans