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