Subject: | allow brackets in a proxy URL |
Date: | Wed, 22 Sep 2010 13:53:01 +0900 (JST) |
To: | bug-libwww-perl [...] rt.cpan.org |
From: | Sohgo Takeuchi <sohgo [...] sohgo.dyndns.org> |
Dear libwww maintainer,
Thanks for providing us a great perl package, libwww.
I have used LWP::UserAgent module with IPv6. When I specify an
IPv6 address with *brackets* in proxy function, perl command
says "Bad proxy specification 'http://[2001:db8::1]:3128/' at
test.pm line 8".
-------------------------------------------------------
#!/usr/bin/perl
use Net::INET6Glue::INET_is_INET6;
use LWP::UserAgent;
my $ua = new LWP::UserAgent();
$ua->proxy("http", "http://[2001:db8::1]:3128/");
-------------------------------------------------------
To allow brackets in the URL, can you apply a attached patch?
Thank you.
--
Sohgo Takeuchi
--- libwww-perl-5.837/lib/LWP/UserAgent.pm.old 2010-09-22 13:49:01.000000000 +0900
+++ libwww-perl-5.837/lib/LWP/UserAgent.pm 2010-09-22 13:49:28.000000000 +0900
@@ -914,7 +914,7 @@
my $url = shift;
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,;
+ 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)