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