diff options
author | franck cuny <franck@lumberjaph.net> | 2009-05-18 12:04:39 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2009-05-18 12:04:39 +0200 |
commit | 8efc06b29a7ab7b5dec1ef0ec60c9396fa748803 (patch) | |
tree | ccc1357cc2c89c7da0737cb7cefba6f3aa00b9e0 | |
parent | patch rt #44391 and #44261 (diff) | |
download | lwpx-paranoidagent-8efc06b29a7ab7b5dec1ef0ec60c9396fa748803.tar.gz |
apply patch by SREZIC rt #44569 master
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | lib/LWPx/ParanoidAgent.pm | 1 | ||||
-rw-r--r-- | t/30-mirror.t | 27 |
3 files changed, 29 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST index d6a2083..d2fecb6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5,4 +5,5 @@ lib/LWPx/Protocol/http_paranoid.pm lib/LWPx/Protocol/https_paranoid.pm lib/LWPx/ParanoidAgent.pm t/00-all.t +t/30-mirror.t META.yml Module meta-data (added by MakeMaker) diff --git a/lib/LWPx/ParanoidAgent.pm b/lib/LWPx/ParanoidAgent.pm index bc2669b..f540f45 100644 --- a/lib/LWPx/ParanoidAgent.pm +++ b/lib/LWPx/ParanoidAgent.pm @@ -325,6 +325,7 @@ EOT $response->request($request); # record request for reference $cookie_jar->extract_cookies($response) if $cookie_jar; $response->header("Client-Date" => HTTP::Date::time2str(time)); + $self->run_handlers("response_done", $response); return $response; } diff --git a/t/30-mirror.t b/t/30-mirror.t new file mode 100644 index 0000000..9f0a3ea --- /dev/null +++ b/t/30-mirror.t @@ -0,0 +1,27 @@ +# Testing the "Transfer truncated: only ... out of .. bytes received" +# case. + +use strict; +use Test::More; + +use File::Temp qw(tempfile); +use Getopt::Long qw(GetOptions); +use LWPx::ParanoidAgent; + +my $url; +GetOptions("url=s" => \$url) + or die "usage: $0 [-url url]"; + +if (!$url) { + plan skip_all => 'Mirror tests needs -url option'; + exit; +} + +plan tests => 1; + +my(undef, $tempfile) = tempfile(UNLINK => 1); +unlink $tempfile; # we only need the filename +my $ua = LWPx::ParanoidAgent->new; +my $resp = $ua->mirror($url, $tempfile); +ok($resp->is_success) + or diag($resp->as_string); |