]> sjero.net Git - wget/blob - tests/Test-ftp-list-Unknown.px
"LIST" or "LIST -a" ftp command according to the remote system
[wget] / tests / Test-ftp-list-Unknown.px
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
13 use strict;
14 use warnings;
15
16 use FTPTest;
17
18
19 ###############################################################################
20
21 my $afile = <<EOF;
22 Some text.
23 EOF
24
25 my $bfile = <<EOF;
26 Some more text.
27 EOF
28
29 $afile =~ s/\n/\r\n/g;
30 $bfile =~ s/\n/\r\n/g;
31
32 # code, msg, headers, content
33 my %urls = (
34     '/afile.txt' => {
35         content => $afile,
36     },
37     '/bfile.txt' => {
38         content => $bfile,
39     },
40 );
41
42 my $cmdline = $WgetTest::WGETPATH . " --no-directories --recursive --level=1 --accept \"?file.txt\" ftp://localhost:{{port}}/";
43
44 my $expected_error_code = 0;
45
46 my %expected_downloaded_files = (
47     'afile.txt' => {
48         content => $afile,
49     },
50     'bfile.txt' => {
51         content => $bfile,
52     },
53 );
54
55 ###############################################################################
56
57 my $the_test = FTPTest->new (name => "Test-ftp-list-Unknown",
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"});
64 exit $the_test->run();
65