File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,26 @@ if ( $Net::HTTPS::SSL_SOCKET_CLASS->can('start_SSL')) {
9999 # SNI should be passed there only if it is not an IP address.
100100 # Details: https://github.com/libwww-perl/libwww-perl/issues/449#issuecomment-1896175509
101101 my $host = $url -> host() =~ m / :|^[\d .] +$ / s ? undef : $url -> host();
102- $sock = LWP::Protocol::https::Socket-> start_SSL( $sock ,
102+ my $usebio = {};
103+ if (UNIVERSAL::can($sock ,' is_SSL' ) && $sock -> is_SSL) {
104+ $usebio = eval { $Net::HTTPS::SSL_SOCKET_CLASS -> can_nested_ssl } or
105+ die " no support for nested TLS in this IO::Socket::SSL version" ;
106+ }
107+
108+ $sock = LWP::Protocol::https::Socket-> start_SSL( my $osock = $sock ,
103109 SSL_verifycn_name => $url -> host,
104110 SSL_hostname => $host ,
111+ %$usebio ,
105112 $self -> _extra_sock_opts,
106113 );
107- $@ = LWP::Protocol::https::Socket-> errstr if ! $sock ;
114+ if (!$sock ) {
115+ $@ = LWP::Protocol::https::Socket-> errstr;
116+ return ;
117+ }
118+ if ($usebio and my @fields = grep { / ^http_/ } keys %{*$osock }) {
119+ # propagate any http_ fields from osock to sock
120+ @{*$sock }{@fields } = @{*$osock }{@fields }
121+ }
108122 return $sock ;
109123 }
110124}
You can’t perform that action at this time.
0 commit comments