ezekiel has asked for the wisdom of the Perl Monks concerning the following question:
Hello all
I have a simple script (a summary of it below) designed to automate the download of a bunch of files via http. It works fine when I run it from one system but on a second system I get the error message:
500 Status read failed: Connection reset by peer
I'm guessing some sort of proxy/firewall issue that affects the second system but not the first. However, I'm not sure where to start to check what the problem is and then how to correct it?
Thanks for your advice
#! /usr/bin/perl -w use strict; use LWP::UserAgent; my @files = ( "file1.gz", "file2.gz", "file3.gz" ); my $ua = LWP::UserAgent->new(); foreach my $file (@files) { my $url = "http://site.com/directory/" . $file; my $request = new HTTP::Request( GET => "$url" ); my $response = $ua->request($request, $file); if ($response->is_success) { print "Got file $file\n"; } else { die $response->status_line; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::UserAgent - works on one system, fails on another
by Anonymous Monk on May 29, 2013 at 04:18 UTC | |
|
Re: LWP::UserAgent - works on one system, fails on another
by hippo (Archbishop) on May 29, 2013 at 14:02 UTC |