file: add support for getting basic directory listings

Not supported on Windows (yet)

Closes #13137
This commit is contained in:
Colin Leroy-Mira 2024-03-16 12:39:01 +01:00 committed by Daniel Stenberg
parent e14daeb8a4
commit bfe54b0e88
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 148 additions and 38 deletions

View file

@ -261,4 +261,4 @@ test3024 test3025 test3026 test3027 test3028 test3029 test3030 \
\
test3100 test3101 test3102 test3103 \
test3200 \
test3201 test3202
test3201 test3202 test3203

View file

@ -39,6 +39,7 @@ Usage: curl [options...] <url>
file: FILE protocol options
--create-file-mode <mode> File mode for created files
-I, --head Show document info only
-l, --list-only List only mode
-r, --range <range> Retrieve only the bytes within RANGE
</stdout>
</verify>

View file

@ -39,6 +39,7 @@ Usage: curl [options...] <url>
file: FILE protocol options
--create-file-mode <mode> File mode for created files
-I, --head Show document info only
-l, --list-only List only mode
-r, --range <range> Retrieve only the bytes within RANGE
</stdout>
</verify>

41
tests/data/test3203 Normal file
View file

@ -0,0 +1,41 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
FILE
</keywords>
</info>
#
# Client-side
<client>
<server>
file
</server>
<name>
GET a directory using file://
</name>
<!-- doesn't work on win32, see #6379 -->
<features>
!win32
</features>
<command option="no-include">
file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.dir/
</command>
<file name="%LOGDIR/test%TESTNUMBER.dir/dir-listing-test.txt">
Contents of file are irrelevant
</file>
</client>
#
# Verify data after the test has been "shot"
<verify>
<errorcode>
0
</errorcode>
<stdout>
dir-listing-test.txt
</stdout>
</verify>
</testcase>