From d9246ff24dfbf702b03be6dd359abb937a4d3653 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 28 Jul 2003 08:50:02 +0000 Subject: =?UTF-8?q?Fran=E7ois=20Pons=20brought=20a=20patch=20that=20once?= =?UTF-8?q?=20again=20made=20curl=20deal=20with=20ftp=20and=20"double=20sl?= =?UTF-8?q?ash"=20as=20indicating=20the=20root=20directory.=20In=20the=20R?= =?UTF-8?q?FC1738-fix=20of=20April=2030,=20that=20ability=20was=20removed?= =?UTF-8?q?=20(since=20it=20is=20not=20the=20"right"=20way).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ftp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/ftp.c') diff --git a/lib/ftp.c b/lib/ftp.c index c57b42d11..3d8f4d314 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2134,12 +2134,16 @@ CURLcode Curl_ftp(struct connectdata *conn) /* parse the URL path into separate path components */ while((slash_pos=strchr(cur_pos, '/'))) { + /* 1 or 0 to indicate absolute directory */ + bool absolute_dir = (cur_pos - conn->ppath > 0) && (path_part == 0); + /* seek out the next path component */ if (slash_pos-cur_pos) { /* we skip empty path components, like "x//y" since the FTP command CWD requires a parameter and a non-existant parameter a) doesn't work on many servers and b) has no effect on the others. */ - ftp->dirs[path_part] = curl_unescape(cur_pos,slash_pos-cur_pos); + ftp->dirs[path_part] = curl_unescape(cur_pos - absolute_dir, + slash_pos - cur_pos + absolute_dir); if (!ftp->dirs[path_part]) { /* run out of memory ... */ failf(data, "no memory"); -- cgit v1.2.3