knirirr has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use the modules mentioned above to fetch zip files over https, using ActivePerl 5.8.9 on a Windows 7 machine. Here's a section of the code:
sub Download { my $u = shift; # URL (e.g. https://server.org/file.zip) my $p = shift; # output file path/name my $ua = LWP::UserAgent->new; $ua->timeout(10); my $req = HTTP::Request->new('GET', $u); my $res = $ua->request($req); print "Requesting $u\n"; open OUT, ">", $p or die "Can't save output: $!"; binmode(OUT); if ($res->is_success) { print OUT $res->content; close OUT or die "$!"; return 0; } else { print "Could not fetch $u\n"; close OUT or die "$!"; return 1; } }
The SSL connection seems to be negotiated correctly and the code is able to fetch a 500-byte file, but when I try files around 200K in size the script hangs. Does anyone have any suggestions?
|
|---|