--- d:\src\libs\curl-7.17.1-20070925\lib\ftp.c  2007-09-25 04:00:02.000000000 +0200
+++ d:\src\libs\curl\lib\ftp.c  2007-09-25 18:13:30.239163200 +0200
@@ -742,7 +742,7 @@
     result = ftp_state_post_cwd(conn);
   else {
     ftpc->count2 = 0;
-    if (conn->bits.reuse && ftpc->entrypath) {
+    if (conn->bits.reuse && ftpc->entrypath && !conn->data->set.ftp_abs_only) {
       /* This is a re-used connection. Since we change directory to where the
          transfer is taking place, we must first get back to the original dir
          where we ended up after login: */


--- d:\src\libs\curl-7.17.1-20070925\lib\urldata.h  2007-09-19 04:00:02.000000000 +0200
+++ d:\src\libs\curl\lib\urldata.h  2007-09-25 18:10:10.538024600 +0200
@@ -1384,6 +1383,7 @@
   bool prefer_ascii;    /* ASCII rather than binary */
   bool ftp_append;
   bool ftp_list_only;
+  bool ftp_abs_only;  /* absolute paths only to prevent CWD to entry path */
   bool ftp_create_missing_dirs;
   bool ftp_use_port;
   bool hide_progress;
   
--- d:\src\libs\curl-7.17.1-20070925\include\curl\curl.h  2007-09-01 04:00:02.000000000 +0200
+++ d:\src\libs\curl\include\curl\curl.h  2007-09-25 18:01:33.624431000 +0200
@@ -1124,6 +1124,11 @@
   CINIT(NEW_FILE_PERMS, LONG, 159),
   CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
 
+  /* absolute paths only to prevent libcurl from CWDing
+     into the entrypath when re-using connections */
+
+  CINIT(FTP_ABSONLY, LONG, 161),
+
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
 
--- d:\src\libs\curl-7.17.1-20070925\lib\url.c  2007-09-01 04:00:02.000000000 +0200
+++ d:\src\libs\curl\lib\url.c  2007-09-25 18:01:33.524285000 +0200
@@ -820,6 +820,13 @@
      */
     data->set.ftp_list_only = (bool)(0 != va_arg(param, long));
     break;
+  case CURLOPT_FTP_ABSONLY:
+    /*
+     * An option that prevents CWDing into the entrypath
+     * when re-using connections (absolute paths only).
+     */
+    data->set.ftp_abs_only = (bool)(0 != va_arg(param, long));
+    break;
   case CURLOPT_APPEND:
     /*
      * We want to upload and append to an existing file.
