Change history for libwww-perl
+6.63 2022-04-25 15:24:10Z
+ - Redirect on meta refresh (GH#409) (grr)
+
6.62 2022-04-05 01:04:17Z
- Allow downloading to a filehandle (GH#400) (Andrew Fresh)
"provides" : {
"LWP" : {
"file" : "lib/LWP.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Authen::Basic" : {
"file" : "lib/LWP/Authen/Basic.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Authen::Digest" : {
"file" : "lib/LWP/Authen/Digest.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Authen::Ntlm" : {
"file" : "lib/LWP/Authen/Ntlm.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::ConnCache" : {
"file" : "lib/LWP/ConnCache.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Debug" : {
"file" : "lib/LWP/Debug.pm",
- "version" : "6.62",
+ "version" : "6.63",
"x_deprecated" : 1
},
"LWP::Debug::TraceHTTP" : {
"file" : "lib/LWP/Debug/TraceHTTP.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::DebugFile" : {
"file" : "lib/LWP/DebugFile.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::MemberMixin" : {
"file" : "lib/LWP/MemberMixin.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol" : {
"file" : "lib/LWP/Protocol.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::cpan" : {
"file" : "lib/LWP/Protocol/cpan.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::data" : {
"file" : "lib/LWP/Protocol/data.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::file" : {
"file" : "lib/LWP/Protocol/file.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::ftp" : {
"file" : "lib/LWP/Protocol/ftp.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::gopher" : {
"file" : "lib/LWP/Protocol/gopher.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::http" : {
"file" : "lib/LWP/Protocol/http.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::loopback" : {
"file" : "lib/LWP/Protocol/loopback.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::mailto" : {
"file" : "lib/LWP/Protocol/mailto.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::nntp" : {
"file" : "lib/LWP/Protocol/nntp.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Protocol::nogo" : {
"file" : "lib/LWP/Protocol/nogo.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::RobotUA" : {
"file" : "lib/LWP/RobotUA.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::Simple" : {
"file" : "lib/LWP/Simple.pm",
- "version" : "6.62"
+ "version" : "6.63"
},
"LWP::UserAgent" : {
"file" : "lib/LWP/UserAgent.pm",
- "version" : "6.62"
+ "version" : "6.63"
}
},
"release_status" : "stable",
"x_IRC" : "irc://irc.perl.org/#lwp",
"x_MailingList" : "mailto:libwww@perl.org"
},
- "version" : "6.62",
+ "version" : "6.63",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.034001"
"class" : "Dist::Zilla::Plugin::Git::Contributors",
"config" : {
"Dist::Zilla::Plugin::Git::Contributors" : {
- "git_version" : "2.35.1",
+ "git_version" : "2.36.0",
"include_authors" : 0,
"include_releaser" : 1,
"order_by" : "name",
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
- "git_version" : "2.35.1",
+ "git_version" : "2.36.0",
"repo_root" : "."
}
},
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
- "git_version" : "2.35.1",
+ "git_version" : "2.36.0",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"branch" : null,
"changelog" : "Changes",
"signed" : 0,
- "tag" : "v6.62",
+ "tag" : "v6.63",
"tag_format" : "v%V",
"tag_message" : "v%V"
},
"Dist::Zilla::Role::Git::Repo" : {
- "git_version" : "2.35.1",
+ "git_version" : "2.36.0",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
- "git_version" : "2.35.1",
+ "git_version" : "2.36.0",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"remotes_must_exist" : 1
},
"Dist::Zilla::Role::Git::Repo" : {
- "git_version" : "2.35.1",
+ "git_version" : "2.36.0",
"repo_root" : "."
}
},
"Graeme Thompson <Graeme.Thompson@mobilecohesion.com>",
"Graham Knop <haarg@haarg.org>",
"Gregory Oschwald <oschwald@gmail.com>",
+ "grr <grr@users.noreply.github.com>",
"Hans-H. Froehlich <hfroehlich@co-de-co.de>",
"Ian Kilgore <iank@cpan.org>",
"Jacob J <waif@chaos2.org>",
provides:
LWP:
file: lib/LWP.pm
- version: '6.62'
+ version: '6.63'
LWP::Authen::Basic:
file: lib/LWP/Authen/Basic.pm
- version: '6.62'
+ version: '6.63'
LWP::Authen::Digest:
file: lib/LWP/Authen/Digest.pm
- version: '6.62'
+ version: '6.63'
LWP::Authen::Ntlm:
file: lib/LWP/Authen/Ntlm.pm
- version: '6.62'
+ version: '6.63'
LWP::ConnCache:
file: lib/LWP/ConnCache.pm
- version: '6.62'
+ version: '6.63'
LWP::Debug:
file: lib/LWP/Debug.pm
- version: '6.62'
+ version: '6.63'
x_deprecated: 1
LWP::Debug::TraceHTTP:
file: lib/LWP/Debug/TraceHTTP.pm
- version: '6.62'
+ version: '6.63'
LWP::DebugFile:
file: lib/LWP/DebugFile.pm
- version: '6.62'
+ version: '6.63'
LWP::MemberMixin:
file: lib/LWP/MemberMixin.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol:
file: lib/LWP/Protocol.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::cpan:
file: lib/LWP/Protocol/cpan.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::data:
file: lib/LWP/Protocol/data.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::file:
file: lib/LWP/Protocol/file.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::ftp:
file: lib/LWP/Protocol/ftp.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::gopher:
file: lib/LWP/Protocol/gopher.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::http:
file: lib/LWP/Protocol/http.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::loopback:
file: lib/LWP/Protocol/loopback.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::mailto:
file: lib/LWP/Protocol/mailto.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::nntp:
file: lib/LWP/Protocol/nntp.pm
- version: '6.62'
+ version: '6.63'
LWP::Protocol::nogo:
file: lib/LWP/Protocol/nogo.pm
- version: '6.62'
+ version: '6.63'
LWP::RobotUA:
file: lib/LWP/RobotUA.pm
- version: '6.62'
+ version: '6.63'
LWP::Simple:
file: lib/LWP/Simple.pm
- version: '6.62'
+ version: '6.63'
LWP::UserAgent:
file: lib/LWP/UserAgent.pm
- version: '6.62'
+ version: '6.63'
requires:
Digest::MD5: '0'
Encode: '2.12'
bugtracker: https://github.com/libwww-perl/libwww-perl/issues
homepage: https://github.com/libwww-perl/libwww-perl
repository: https://github.com/libwww-perl/libwww-perl.git
-version: '6.62'
+version: '6.63'
x_Dist_Zilla:
perl:
version: '5.034001'
class: Dist::Zilla::Plugin::Git::Contributors
config:
Dist::Zilla::Plugin::Git::Contributors:
- git_version: 2.35.1
+ git_version: 2.36.0
include_authors: 0
include_releaser: 1
order_by: name
allow_dirty_match: []
changelog: Changes
Dist::Zilla::Role::Git::Repo:
- git_version: 2.35.1
+ git_version: 2.36.0
repo_root: .
name: Git::Check
version: '2.048'
allow_dirty_match: []
changelog: Changes
Dist::Zilla::Role::Git::Repo:
- git_version: 2.35.1
+ git_version: 2.36.0
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
branch: ~
changelog: Changes
signed: 0
- tag: v6.62
+ tag: v6.63
tag_format: v%V
tag_message: v%V
Dist::Zilla::Role::Git::Repo:
- git_version: 2.35.1
+ git_version: 2.36.0
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
- (?^:^lib/.*\.pm$)
changelog: Changes
Dist::Zilla::Role::Git::Repo:
- git_version: 2.35.1
+ git_version: 2.36.0
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
- origin
remotes_must_exist: 1
Dist::Zilla::Role::Git::Repo:
- git_version: 2.35.1
+ git_version: 2.36.0
repo_root: .
name: Git::Push
version: '2.048'
- 'Graeme Thompson <Graeme.Thompson@mobilecohesion.com>'
- 'Graham Knop <haarg@haarg.org>'
- 'Gregory Oschwald <oschwald@gmail.com>'
+ - 'grr <grr@users.noreply.github.com>'
- 'Hans-H. Froehlich <hfroehlich@co-de-co.de>'
- 'Ian Kilgore <iank@cpan.org>'
- 'Jacob J <waif@chaos2.org>'
"Test::Needs" => 0,
"Test::RequiresInternet" => 0
},
- "VERSION" => "6.62",
+ "VERSION" => "6.63",
"test" => {
"TESTS" => "t/*.t t/base/*.t t/base/protocols/*.t t/leak/*.t t/local/*.t t/robot/*.t"
}
package LWP;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require LWP::UserAgent; # this should load everything you need
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require Encode;
require MIME::Base64;
use strict;
use parent 'LWP::Authen::Basic';
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require Digest::MD5;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
use Authen::NTLM "1.02";
use MIME::Base64 "2.12";
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
our $DEBUG;
sub new {
package LWP::Debug; # legacy
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require Exporter;
our @ISA = qw(Exporter);
use strict;
use parent 'LWP::Protocol::http';
-our $VERSION = '6.62';
+our $VERSION = '6.63';
package # hide from PAUSE
LWP::Debug::TraceHTTP::Socket;
package LWP::DebugFile;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
# legacy stub
package LWP::MemberMixin;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
sub _elem {
my $self = shift;
use parent 'LWP::MemberMixin';
-our $VERSION = '6.62';
+our $VERSION = '6.63';
use strict;
use Carp ();
use parent qw(LWP::Protocol);
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require URI;
require HTTP::Status;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require HTTP::Response;
require HTTP::Status;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require LWP::MediaTypes;
require HTTP::Request;
use parent qw(LWP::Protocol);
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
use Carp ();
use HTTP::Status ();
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require HTTP::Response;
require HTTP::Status;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require HTTP::Response;
require HTTP::Status;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require HTTP::Response;
use Carp;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
use parent qw(LWP::Protocol);
our $SENDMAIL;
use parent qw(LWP::Protocol);
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require HTTP::Response;
require HTTP::Status;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require HTTP::Response;
require HTTP::Status;
use parent qw(LWP::UserAgent);
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require WWW::RobotRules;
require HTTP::Request;
use strict;
-our $VERSION = '6.62';
+our $VERSION = '6.63';
require Exporter;
use Scalar::Util qw(blessed openhandle);
use Try::Tiny qw(try catch);
-our $VERSION = '6.62';
+our $VERSION = '6.63';
sub new
{
$response->previous($previous) if $previous;
if ($response->redirects >= $self->{max_redirect}) {
- if ($response->header('Location')) {
+ if ($response->header('Location') or $response->header('Refresh')) {
$response->header("Client-Warning" =>
"Redirect loop detected (max_redirect = $self->{max_redirect})"
);
my $flag = shift;
my $parser;
my $old = $self->set_my_handler("response_header", $flag ? sub {
- my($response, $ua) = @_;
- require HTML::HeadParser;
- $parser = HTML::HeadParser->new;
- $parser->xml_mode(1) if $response->content_is_xhtml;
- $parser->utf8_mode(1) if $] >= 5.008 && $HTML::Parser::VERSION >= 3.40;
-
- push(@{$response->{handlers}{response_data}}, {
- callback => sub {
- return unless $parser;
- unless ($parser->parse($_[3])) {
- my $h = $parser->header;
- my $r = $_[0];
- for my $f ($h->header_field_names) {
- $r->init_header($f, [$h->header($f)]);
- }
- undef($parser);
- }
- },
- });
-
+ my($response, $ua) = @_;
+ require HTML::HeadParser;
+ $parser = HTML::HeadParser->new;
+ $parser->xml_mode(1) if $response->content_is_xhtml;
+ $parser->utf8_mode(1) if $] >= 5.008 && $HTML::Parser::VERSION >= 3.40;
+
+ push(@{$response->{handlers}{response_data}}, {
+ callback => sub {
+ return unless $parser;
+ unless ($parser->parse($_[3])) {
+ my $h = $parser->header;
+ my $r = $_[0];
+ for my $f ($h->header_field_names) {
+ $r->init_header($f, [$h->header($f)]);
+ }
+ undef($parser);
+ }
+ },
+ });
+ push(@{$response->{handlers}{response_redirect}}, {
+ callback => sub {
+ my ($res, $ua, $handler, $data) = @_;
+ my $refresh = $res->header('refresh') or return;
+ my ($url) = $refresh =~ /;\s*url\s*=\s*['"]?([^"'>]+)/i
+ or return;
+ require HTML::Entities;
+ HTML::Entities::decode($url);
+ my $uri = URI->new_abs($url, $res->request->uri)->canonical;
+ my $base = $res->request->uri;
+ my $uri = $base->new_abs($url, $base);
+ return if $uri == $base;
+ return HTTP::Request->new(
+ GET => $uri, [referer => $base]
+ );
+ },
+ });
} : undef,
m_media_type => "html",
);
return plan skip_all => 'We could not talk to our daemon' unless $DAEMON;
return plan skip_all => 'No base URI' unless $base;
- plan tests => 130;
+ plan tests => 136;
my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/0.01 " . $ua->agent);
$res = $ua->request($req);
isa_ok($res, 'HTTP::Response', 'redirect loop: good response object');
}
+ { # meta refresh
+ my $req = HTTP::Request->new(GET => url("/meta_refresh", $base));
+ my $res = $ua->request($req);
+
+ ok($res->is_success, 'meta_refresh: is_success');
+ like($res->content, qr|/echo/meta_refresh|, 'meta_refresh: content good');
+ is($res->previous->code, 200, 'meta_refresh: code 200');
+ is($res->redirects, 1, 'meta_refresh redirect count: 1');
+
+ $ua->max_redirect(0);
+ $res = $ua->request($req);
+ is($res->redirects, 0, 'meta_refresh redirect loop: 0 redirects');
+ like($res->header("Client-Warning"), qr/loop detected/i, 'meta_refresh redirect loop: client warning');
+ $ua->max_redirect(5);
+ }
{ # basic auth
my $req = HTTP::Request->new(GET => url("/basic", $base));
my $res = MyUA->new->request($req);
$router{get_redirect2} = sub { shift->send_redirect("/redirect3/") };
$router{get_redirect3} = sub { shift->send_redirect("/redirect2/") };
$router{get_redirect4} = sub { my $r = HTTP::Response->new(303); shift->send_response($r) };
+ $router{get_meta_refresh} = sub {
+ my($c,$r) = @_;
+ $c->send_basic_header;
+ $c->print("Content-Type: text/html");
+ $c->send_crlf;
+ $c->send_crlf;
+ $c->print(<<' HTML');
+ <html>
+ <head>
+ <meta http-equiv='refresh' content='0; url=/echo/meta_refresh' />
+ </head>
+ </html>
+ HTML
+ };
$router{post_echo} = sub {
my($c,$r) = @_;
$c->send_basic_header;
gopher
gpeters
granny
+grr
haarg
hfroehlich
http
note 'Checking Changes';
my $changes_file = 'Changes';
-my $newver = '6.62';
+my $newver = '6.63';
my $trial_token = '-TRIAL';
my $encoding = 'UTF-8';