]> sjero.net Git - wget/blob - tests/Test-ftp-list-Unknown-a.px
Fix build when libpsl is not available
[wget] / tests / Test-ftp-list-Unknown-a.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 is a file
8 #   called "-a".
9 # wget should use "LIST -a", but also "LIST".
10 # After "LIST", wget will see more data is available.
11 # (See also Test-ftp-list-Unknown-b.px)
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
30 my $minusafile = <<EOF;
31 The strange situation.
32 EOF
33
34 $afile =~ s/\n/\r\n/g;
35 $bfile =~ s/\n/\r\n/g;
36 $minusafile =~ s/\n/\r\n/g;
37
38 # code, msg, headers, content
39 my %urls = (
40     '/afile.txt' => {
41         content => $afile,
42     },
43     '/bfile.txt' => {
44         content => $bfile,
45     },
46     '/-a' => {
47         content => $minusafile,
48     },
49 );
50
51 my $cmdline = $WgetTest::WGETPATH . " --no-directories --recursive --level=1 ftp://localhost:{{port}}/";
52
53 my $expected_error_code = 0;
54
55 my %expected_downloaded_files = (
56     'afile.txt' => {
57         content => $afile,
58     },
59     'bfile.txt' => {
60         content => $bfile,
61     },
62     '-a' => {
63         content => $minusafile,
64     },
65 );
66
67 ###############################################################################
68
69 my $the_test = FTPTest->new (name => "Test-ftp-list-Unknown-a",
70                              input => \%urls,
71                              cmdline => $cmdline,
72                              errcode => $expected_error_code,
73                              output => \%expected_downloaded_files,
74                              server_behavior => {list_dont_clean_path => 1,
75                                                  syst_response => "215 Unknown ftp service"});
76 exit $the_test->run();
77