SVN: toys/rsget.pl/RSGet/Curl.pm

sparky sparky at pld-linux.org
Tue Oct 27 01:05:59 CET 2009


Author: sparky
Date: Tue Oct 27 01:05:57 2009
New Revision: 10868

Modified:
   toys/rsget.pl/RSGet/Curl.pm
Log:
- allow to specify size of downloaded file


Modified: toys/rsget.pl/RSGet/Curl.pm
==============================================================================
--- toys/rsget.pl/RSGet/Curl.pm	(original)
+++ toys/rsget.pl/RSGet/Curl.pm	Tue Oct 27 01:05:57 2009
@@ -131,6 +131,7 @@
 		$curl->setopt( CURLOPT_WRITEFUNCTION, \&body_file );
 		$curl->setopt( CURLOPT_WRITEDATA, $supercurl );
 
+		$supercurl->{force_size} = $opts{fsize} if $opts{fsize};
 		$supercurl->{force_name} = $opts{fname} if $opts{fname};
 
 		# if file exists try to continue
@@ -246,6 +247,9 @@
 	if ( my $f_len = $curl->getinfo( CURLINFO_CONTENT_LENGTH_DOWNLOAD ) ) {
 		$supercurl->{size_total} = $f_len;
 	}
+	if ( $supercurl->{size_total} <= 0 and $supercurl->{force_size} ) {
+		$supercurl->{size_total} = $supercurl->{force_size};
+	}
 
 	dump_to_file( $supercurl->{head}, "head" ) if verbose( 5 );
 	my $fname;


More information about the pld-cvs-commit mailing list