=== 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];
},