1#!/usr/bin/env perl
2
3# 2013-10-17 Andrea Urbani (matfanjol)
4# In this ftp test:
5# - the response of "LIST -a" command contains
6#   all the files
7# - the response of "LIST" command contains
8#   the normal files (hidden files are not present)
9# wget should use only "LIST -a" because it recognise
10# the system as "UNIX Type: L8" and so it should see
11# and download the hidden file too.
12
13use strict;
14use warnings;
15
16use FTPTest;
17
18
19###############################################################################
20
21my $normalfile = <<EOF;
22I'm a normal file
23EOF
24
25my $hiddenfile = <<EOF;
26I'm an hidden file
27EOF
28
29$normalfile =~ s/\n/\r\n/g;
30$hiddenfile =~ s/\n/\r\n/g;
31
32# code, msg, headers, content
33my %urls = (
34    '/normalfile.txt' => {
35        content => $normalfile,
36    },
37    '/hiddenfile.txt' => {
38        content => $hiddenfile,
39        attr => "H",
40    },
41);
42
43my $cmdline = $WgetTest::WGETPATH . " --no-directories --recursive --level=1 ftp://localhost:{{port}}/";
44
45my $expected_error_code = 0;
46
47my %expected_downloaded_files = (
48    'normalfile.txt' => {
49        content => $normalfile,
50    },
51    'hiddenfile.txt' => {
52        content => $hiddenfile,
53    },
54);
55
56###############################################################################
57
58my $the_test = FTPTest->new (
59                             input => \%urls,
60                             cmdline => $cmdline,
61                             errcode => $expected_error_code,
62                             output => \%expected_downloaded_files,
63                             server_behavior => {list_no_hidden_if_list => 1});
64exit $the_test->run();
65