1#!/usr/bin/env perl
2
3
4# 2013-10-17 Andrea Urbani (matfanjol)
5# In this ftp test:
6# - the response of "LIST -a" command is a failure
7# wget should use "LIST -a" then "LIST" to get the right
8# content.
9
10use strict;
11use warnings;
12
13use FTPTest;
14
15
16###############################################################################
17
18my $afile = <<EOF;
19Some text.
20EOF
21
22my $bfile = <<EOF;
23Some more text.
24EOF
25
26$afile =~ s/\n/\r\n/g;
27$bfile =~ s/\n/\r\n/g;
28
29# code, msg, headers, content
30my %urls = (
31    '/afile.txt' => {
32        content => $afile,
33    },
34    '/bfile.txt' => {
35        content => $bfile,
36    },
37);
38
39my $cmdline = $WgetTest::WGETPATH . " --no-directories --recursive --level=1 --accept \"?file.txt\" ftp://localhost:{{port}}/";
40
41my $expected_error_code = 0;
42
43my %expected_downloaded_files = (
44    'afile.txt' => {
45        content => $afile,
46    },
47    'bfile.txt' => {
48        content => $bfile,
49    },
50);
51
52###############################################################################
53
54my $the_test = FTPTest->new (
55                             input => \%urls,
56                             cmdline => $cmdline,
57                             errcode => $expected_error_code,
58                             output => \%expected_downloaded_files,
59                             server_behavior => {list_fails_if_list_a => 1,
60                                                 syst_response => "215 Unknown ftp service"});
61exit $the_test->run();
62