From 61d259f95045c2ec029d4234af80b00d91fec080 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 12 Apr 2013 15:29:28 +0200 Subject: FTP: access files in root dir correctly Accessing a file with an absolute path in the root dir but with no directory specified was not handled correctly. This fix comes with four new test cases that verify it. Bug: http://curl.haxx.se/mail/lib-2013-04/0142.html Reported by: Sam Deane --- tests/data/Makefile.am | 2 +- tests/data/test106 | 3 ++- tests/data/test1224 | 49 +++++++++++++++++++++++++++++++++++++++++++ tests/data/test1225 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test1226 | 49 +++++++++++++++++++++++++++++++++++++++++++ tests/data/test1227 | 48 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 tests/data/test1224 create mode 100644 tests/data/test1225 create mode 100644 tests/data/test1226 create mode 100644 tests/data/test1227 (limited to 'tests/data') diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index d96ac02c7..c3857d2f5 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -90,7 +90,7 @@ test1128 test1129 test1130 test1131 test1132 test1133 \ test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \ test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \ test1216 test1217 test1218 \ -test1220 test1221 test1222 test1223 \ +test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \ \ test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \ test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \ diff --git a/tests/data/test106 b/tests/data/test106 index d1b9a81b9..56eca6420 100644 --- a/tests/data/test106 +++ b/tests/data/test106 @@ -39,7 +39,8 @@ FTP GET with type=A style ASCII URL using %20 codes USER anonymous PASS ftp@example.com PWD -CWD /path with spaces +CWD / +CWD path with spaces CWD and things2 EPSV TYPE A diff --git a/tests/data/test1224 b/tests/data/test1224 new file mode 100644 index 000000000..315936b99 --- /dev/null +++ b/tests/data/test1224 @@ -0,0 +1,49 @@ + + + +FTP +PASV +RETR + + +# Server-side + + +data + to + see +that FTP +works + so does it? + + + +# Client-side + + +ftp + + +FTP fetch a file from the root directory + + +ftp://%HOSTIP:%FTPPORT//1224 + + + + +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +CWD / +EPSV +TYPE I +SIZE 1224 +RETR 1224 +QUIT + + + diff --git a/tests/data/test1225 b/tests/data/test1225 new file mode 100644 index 000000000..2b2519c94 --- /dev/null +++ b/tests/data/test1225 @@ -0,0 +1,57 @@ + + + +FTP +PASV +RETR + + +# Server-side + + +data + to + see +that FTP +works + so does it? + + + +# Client-side + + +ftp + + +FTP fetch two files using absolute paths + + +ftp://%HOSTIP:%FTPPORT//foo/1225 ftp://%HOSTIP:%FTPPORT//foo/bar/1225 + + + + +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +CWD / +CWD foo +EPSV +TYPE I +SIZE 1225 +RETR 1225 +CWD / +CWD / +CWD foo +CWD bar +EPSV +SIZE 1225 +RETR 1225 +QUIT + + + diff --git a/tests/data/test1226 b/tests/data/test1226 new file mode 100644 index 000000000..6381b122a --- /dev/null +++ b/tests/data/test1226 @@ -0,0 +1,49 @@ + + + +FTP +PASV +RETR + + +# Server-side + + +data + to + see +that FTP +works + so does it? + + + +# Client-side + + +ftp + + +FTP fetch a file from the root directory with singlecwd + + +ftp://%HOSTIP:%FTPPORT//1226 --ftp-method singlecwd + + + + +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +CWD / +EPSV +TYPE I +SIZE 1226 +RETR 1226 +QUIT + + + diff --git a/tests/data/test1227 b/tests/data/test1227 new file mode 100644 index 000000000..46b28d510 --- /dev/null +++ b/tests/data/test1227 @@ -0,0 +1,48 @@ + + + +FTP +PASV +RETR + + +# Server-side + + +data + to + see +that FTP +works + so does it? + + + +# Client-side + + +ftp + + +FTP fetch a file from the root directory with nocwd + + +ftp://%HOSTIP:%FTPPORT//1227 --ftp-method nocwd + + + + +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE I +SIZE /1227 +RETR /1227 +QUIT + + + -- cgit v1.2.3