Subject: | LWP::UserAgent: Bad http proxy specification 'http://[IPv6]...' [patch] |
Forwarded from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714961:
Package: libwww-perl
Version: 6.04-1
Tags: ipv6, patch
The current version of LWP::UserAgent apparently dislikes IPv6
addresses given for proxies. Consider, e. g.:
$ http_proxy=http://\[2001:db8::1\]:3128/ perl -e '
use strict;
use warnings;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new ();
$ua->env_proxy ();
my $r = $ua->get ("http://www.example.org/");
warn ($r->status_line ());
die () unless ($r->is_success ());'
Bad http proxy specification 'http://[2001:db8::1]:3128/' at -e line 1
$
The patch hereby suggested turns it into:
200 OK at -e line 1.
(provided that an IPv6 address of an active HTTP proxy is
given.)
TIA.
Subject: | ipv6-http-proxy.patch |
Description: allow ipv6 proxy specification
Author: Ivan Shmakov <oneingray@gmail.com>
Reviewed-By: Damyan Ivanov <dmn@debian.org>
Bug-Debian: https://bugs.debian.org/714961
--- /usr/share/perl5/LWP/UserAgent.pm 2012-02-18 17:18:12.000000000 +0000
+++ /usr/share/perl5/LWP/UserAgent.pm 2013-07-04 18:24:36.000000000 +0000
@@ -985,7 +985,8 @@
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)