Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 111791
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: A.Guertin [...] F5.com
Cc:
AdminCc:

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



Subject: LWP::Protocol::http does not support authentication for HTTP CONNECT
Date: Fri, 5 Feb 2016 02:22:02 +0000
To: "bug-libwww-perl [...] rt.cpan.org" <bug-libwww-perl [...] rt.cpan.org>
From: Alec Guertin <A.Guertin [...] F5.com>
Sending a HTTP CONNECT to a proxy may prompt a 407 response, however, the request subroutine in LWP::Protocol::http does not make an attempt to handle this case. I believe that the following code from the request subroutine could be updated to support this case: if ( my $upgrade_sub = $proto_https->can('_upgrade_sock')) { my $response = $self->request( HTTP::Request->new('CONNECT',"http://$ssl_tunnel"), $proxy, undef,$size,$timeout ); # Instead of calling die, check if we need to send credentials and try again $response->is_success or die "establishing SSL tunnel failed: ".$response->status_line; $socket = $upgrade_sub->($proto_https, $response->{client_socket},$url) or die "SSL upgrade failed: $@"; } else { $socket = $proto_https->_new_socket($url->host,$url->port,$timeout); } This may also require updating the connection caching code (necessary for NTLM with two 407s): if ($method eq "CONNECT") { $response->{client_socket} = $socket; # so it can be picked up # Save to $conn_cache here return $response; } I am not sure how the writers would prefer to get the credentials, but for my own patch I retrieved them from the associated LWP::UserAgent object.