Subject: | Problem with numeric IPv6 adresses |
Date: | Tue, 18 Nov 2014 10:09:34 +0000 |
To: | "bug-HTTP-Lite [...] rt.cpan.org" <bug-HTTP-Lite [...] rt.cpan.org> |
From: | "Klebsch, Mario" <Mario.Klebsch [...] ime-actia.de> |
Hello,
I am trying to use HTTP::Lite version 2.43 with IPv6 and it seems, that requests containing numerical IPv6-Addresses are failing. The same URL works fine in internet explorer.
Perl version:
This is perl 5, version 16, subversion 1 (v5.16.1) built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2012, Larry Wall
Binary build 1601 [296175] provided by ActiveState http://www.ActiveState.com
Built Aug 30 2012 20:08:55
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Operating system:
Windows 7
Sample code:
----8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<----
#!/usr/bin/perl -w
use strict;
use warnings;
use HTTP::Lite;
my $http = HTTP::Lite->new();
$http->request("http://[fe80::6466:66ff:fe66:6666%11]/");
----8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<----
In my example, I have the following request:
http://[fe80::6466:66ff:fe66:6666%11]/
I traced my problem using the perl debugger and it seems, the regular expression in line 143 used to split the URL does not cope with IPv6 numerical addresses. :(
C:\xxx\yyy>perl -d bug1.pl
Loading DB routines from perl5db.pl version 1.37
Editor support available.
Enter h or 'h h' for help, or 'perldoc perldebug' for more help.
main::(bug1.pl:7): my $http = HTTP::Lite->new();
DB<1> n
main::(bug1.pl:8): $http->request("http://[fe80::6466:66ff:fe66:6666%11]/");
DB<1> s
HTTP::Lite::request(HTTP/Lite.pm:131):
131: my ($self, $url, $data_callback, $cbargs) = @_;
DB<1> n
HTTP::Lite::request(HTTP/Lite.pm:133):
133: my $method = $self->{method};
DB<1> n
HTTP::Lite::request(HTTP/Lite.pm:134):
134: if (defined($cbargs)) {
DB<1> n
HTTP::Lite::request(HTTP/Lite.pm:138):
138: my $callback_func = $self->{'callback_function'};
DB<1> n
HTTP::Lite::request(HTTP/Lite.pm:139):
139: my $callback_params = $self->{'callback_params'};
DB<1> n
HTTP::Lite::request(HTTP/Lite.pm:142):
142: my ($protocol,$host,$junk,$port,$object) =
143: $url =~ m{^([^:/]+)://([^/:]*)(:(\d+))?(/?.*)$};
DB<1> n
HTTP::Lite::request(HTTP/Lite.pm:146):
146: if ($protocol ne "http")
147: {
DB<1> print $host;
[fe80
DB<2> print $object;
::6466:66ff:fe66:6666%11]/
DB<3>
$host should be '[fe80::6466:66ff:fe66:6666%11]' or probably 'fe80::6466:66ff:fe66:6666%11' and $object should be '/'.
Since the address fe80::6466:66ff:fe66:6666 is a link local address, it needs a scope id (%11 in this case). On unixoid systems, scope IDs usually are network interface names like '%eth0', on windows it is just a numerical index.
Thanks in advance,
Mario Klebsch
--
Mario Klebsch Actia I+ME GmbH
Mario.klebsch@ime-actia.de<mailto:Mario.klebsch@ime-actia.de> Dresdenstrasse 17/18
Fon: +49 531 38 701 716 38124 Braunschweig
Fax: +49 531 38 701 88 Germany
Message body is not shown because it is too large.