From d9246ff24dfbf702b03be6dd359abb937a4d3653 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 28 Jul 2003 08:50:02 +0000 Subject: [PATCH] =?utf8?q?Fran=E7ois=20Pons=20brought=20a=20patch=20that?= =?utf8?q?=20once=20again=20made=20curl=20deal=20with=20ftp=20and=20"doubl?= =?utf8?q?e=20slash"=20as=20indicating=20the=20root=20directory.=20In=20th?= =?utf8?q?e=20RFC1738-fix=20of=20April=2030,=20that=20ability=20was=20remo?= =?utf8?q?ved=20(since=20it=20is=20not=20the=20"right"=20way).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/ftp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ftp.c b/lib/ftp.c index c57b42d..3d8f4d3 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"); -- 2.7.4