1#!/usr/bin/env perl 2 3use strict; 4use warnings; 5 6use FTPTest; 7 8# This file exercises a problem in Wget, where if an error was 9# encountered in ftp.c:getftp before the actual file download 10# had started, Wget would believe that it had already downloaded the 11# full contents of the file, and would send a corresponding (erroneous) 12# REST value. 13 14############################################################################### 15 16# From bug report. :) 17my $afile = <<EOF; 18I've included log output (using the -d switch) from when this happens 19below. You'll see that for the retry wget sends a REST command to 20reset the start position before starting the RETR command. I'm 21confused about the argument to REST: 51132. It's the full length in 22bytes of the file to be retrieved. The RETR then shows the entire 23contents of the file being skipped, and wget announces that it 24successfully retrieved and saved 0 bytes. 25EOF 26 27$afile =~ s/\n/\r\n/g; 28 29 30# code, msg, headers, content 31my %urls = ( 32 '/afile.txt' => { 33 content => $afile, 34 }, 35); 36 37my $cmdline = $WgetTest::WGETPATH . " -S ftp://localhost:{{port}}/afile.txt"; 38 39my $expected_error_code = 0; 40 41my %expected_downloaded_files = ( 42 'afile.txt' => { 43 content => $afile, 44 }, 45); 46 47############################################################################### 48 49my $the_test = FTPTest->new ( 50 server_behavior => {fail_on_pasv => 1}, 51 input => \%urls, 52 cmdline => $cmdline, 53 errcode => $expected_error_code, 54 output => \%expected_downloaded_files); 55exit $the_test->run(); 56 57# vim: et ts=4 sw=4 58