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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.