Skip to content
Permalink
Browse files

Item8084: Use LWP features to save the downloaded file

git-svn-id: http://svn.foswiki.org/branches/Release01x00@5635 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
OlivierRaginel OlivierRaginel
OlivierRaginel authored and OlivierRaginel committed Nov 25, 2009
1 parent 3a67176 commit b9b6a2a6d05f88abb5c822bcabd00b5c7d89f8a2
Showing with 5 additions and 10 deletions.
  1. +5 −10 core/tools/extender.pl
@@ -529,24 +529,19 @@ sub getComponent {

my $response;
foreach my $type (@$types) {
$response = $lwp->get( $url . $type );
$f = $downloadDir . '/' . $module . $type;
$response = $lwp->get( $url . $type,
':content_file' => $f );

if ( $response->header( "Client-Warning" ) ) {
print STDERR "Failed to download $module $what\n",
"LWP complains about: ", $response->header( "Client-Warning" );
return;
}
if ( $response->is_success() ) {
$f = $downloadDir . '/' . $module . $type;
open( F, ">$f" ) || die "Failed to open $f for write: $!";
binmode F;
print F $response->content();
close(F);
last;
}
last if $response->is_success();
}

unless ( $f && -e $f ) {
unless ( $f && -s $f ) {
print STDERR "Failed to download $module $what\n",
$response->status_line(), "\n";
return undef;

0 comments on commit b9b6a2a

Please sign in to comment.
You can’t perform that action at this time.