Changeset 20972 for lang/perl/LWP-UserAgent-ProxyConnect
- Timestamp:
- 10/08/08 19:35:04 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/LWP-UserAgent-ProxyConnect/lib/LWP/UserAgent/ProxyConnect.pm
r19136 r20972 7 7 use LWP::UserAgent; 8 8 9 my $method; 9 { 10 use LWP::Protocol::http (); 10 11 11 { 12 use LWP::Protocol::http; 13 no strict 'refs'; 12 my $orig = \&LWP::Protocol::http::request; 14 13 15 $method = delete ${'LWP::Protocol::http::'}{request}; 16 17 *{'LWP::Protocol::http::request'} = sub { 14 my $method = sub { 18 15 my ($self, $request, $proxy, $arg, $size, $timeout) = @_; 19 16 20 if ( (my $scheme = $request->url->scheme)eq 'https' and $proxy) {21 my ($username, $password) = split /:/, ($proxy->userinfo || '');17 if ($request->url->scheme eq 'https' and $proxy) { 18 local $ENV{HTTPS_PROXY} = $proxy->host_port; 22 19 23 local $ENV{HTTPS_PROXY} = $proxy->host_port; 20 no warnings 'uninitialized'; 21 my ($username, $password) = split /:/, $proxy->userinfo; 24 22 local $ENV{HTTPS_PROXY_USERNAME} = $username; 25 23 local $ENV{HTTPS_PROXY_PASSWORD} = $password; 24 use warnings 'uninitialized'; 26 25 27 bless $self, LWP::Protocol::implementor( $scheme);26 bless $self, LWP::Protocol::implementor('https'); 28 27 29 $ method->($self, $request, undef, $arg, $size, $timeout);28 $orig->($self, $request, undef, $arg, $size, $timeout); 30 29 } 31 30 else { 32 $ method->(@_);31 $orig->(@_); 33 32 } 34 33 }; 34 35 no strict 'refs'; 36 no warnings 'redefine'; 37 *{'LWP::Protocol::http::request'} = $method; 35 38 } 36 39
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)