]> sjero.net Git - wget/blob - tests/Test-ftp-list-Unknown-hidden.px
"LIST" or "LIST -a" ftp command according to the remote system
[wget] / tests / Test-ftp-list-Unknown-hidden.px
1 #!/usr/bin/env perl
2
3 # 2013-10-17 Andrea Urbani (matfanjol)
4 # In this ftp test:
5 # - the response of SYST command is
6 #   215 Unknown ftp service
7 # - the response of "LIST -a" command contains
8 #   all the files
9 # - the response of "LIST" command contains
10 #   the normal files (hidden files are not present)
11 # wget should use "LIST -a", but also "LIST".
12 # After "LIST", wget will see more data is available
13 # on "LIST -a", so it should go back to "LIST -a".
14 # (See also Test-ftp-list-Unknown-a.px)
15
16 use strict;
17 use warnings;
18
19 use FTPTest;
20
21
22 ###############################################################################
23
24 my $normalfile = <<EOF;
25 I'm a normal file
26 EOF
27
28 my $hiddenfile = <<EOF;
29 I'm an hidden file
30 EOF
31
32 $normalfile =~ s/\n/\r\n/g;
33 $hiddenfile =~ s/\n/\r\n/g;
34
35 # code, msg, headers, content
36 my %urls = (
37     '/normalfile.txt' => {
38         content => $normalfile,
39     },
40     '/hiddenfile.txt' => {
41         content => $hiddenfile,
42         attr => "H",
43     },
44 );
45
46 my $cmdline = $WgetTest::WGETPATH . " --no-directories --recursive --level=1 ftp://localhost:{{port}}/";
47
48 my $expected_error_code = 0;
49
50 my %expected_downloaded_files = (
51     'normalfile.txt' => {
52         content => $normalfile,
53     },
54     'hiddenfile.txt' => {
55         content => $hiddenfile,
56     },
57 );
58
59 ###############################################################################
60
61 my $the_test = FTPTest->new (name => "Test-ftp-list-Unknown-hidden",
62                              input => \%urls,
63                              cmdline => $cmdline,
64                              errcode => $expected_error_code,
65                              output => \%expected_downloaded_files,
66                              server_behavior => {list_no_hidden_if_list => 1,
67                                                  syst_response => "215 Unknown ftp service"});
68 exit $the_test->run();
69