Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make it possible to unset the proxy settings again

In 5.821 we started to croak if bad proxy URLs was passed in, but
this check should not trigger when we try to unset the proxy URL.

Some also seems to set $ENV{http_proxy} to the empty string.
  • Loading branch information...
commit acfeaa492ec376b24570b559af6073c59f2db38a 1 parent 8ffaf80
@gisle authored
Showing with 8 additions and 3 deletions.
  1. +4 −2 lib/LWP/UserAgent.pm
  2. +4 −1 t/base/ua.t
View
6 lib/LWP/UserAgent.pm
@@ -921,8 +921,10 @@ sub proxy
my $old = $self->{'proxy'}{$key};
if (@_) {
my $url = shift;
- Carp::croak("Proxy must be specified as absolute URI; '$url' is not") unless $url =~ /^$URI::scheme_re:/;
- Carp::croak("Bad http proxy specification '$url'") if $url =~ /^https?:/ && $url !~ m,^https?://\w,;
+ if (defined($url) && length($url)) {
+ Carp::croak("Proxy must be specified as absolute URI; '$url' is not") unless $url =~ /^$URI::scheme_re:/;
+ Carp::croak("Bad http proxy specification '$url'") if $url =~ /^https?:/ && $url !~ m,^https?://\w,;
+ }
$self->{proxy}{$key} = $url;
$self->set_my_handler("request_preprepare", \&_need_proxy)
}
View
5 t/base/ua.t
@@ -3,7 +3,7 @@
use strict;
use Test;
-plan tests => 10;
+plan tests => 12;
use LWP::UserAgent;
@@ -40,3 +40,6 @@ X: y
EOT
ok(ref($clone->{proxy}), 'HASH');
+
+ok($ua->proxy(http => undef), "loopback:");
+ok($ua->proxy('http'), undef);
Please sign in to comment.
Something went wrong with that request. Please try again.