aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-07-28 08:50:02 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-07-28 08:50:02 +0000
commitd9246ff24dfbf702b03be6dd359abb937a4d3653 (patch)
tree67782124bf7b0d938d88f716c2e7745cebb10eac
parent9301bc3444c9a650089d98284d7f2c23c5ecfd34 (diff)
François Pons brought a patch that once again made curl deal with ftp and
"double slash" as indicating the root directory. In the RFC1738-fix of April 30, that ability was removed (since it is not the "right" way).
-rw-r--r--lib/ftp.c6
1 files changed, 5 insertions, 1 deletions
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");