diff -x '*Debug*' -x '*vc6*' -x '*ftpget*' -Naur curl-7.20.0-20091227/include/curl/curl.h curl-pret/include/curl/curl.h
--- curl-7.20.0-20091227/include/curl/curl.h	2009-12-27 04:00:04.000000000 +0100
+++ curl-pret/include/curl/curl.h	2009-12-27 15:01:29.752830900 +0100
@@ -413,6 +413,7 @@
                                     wrong format (Added in 7.19.0) */
   CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in
                                     7.19.0) */
+  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */
   CURL_LAST /* never use! */
 } CURLcode;
 
@@ -1291,6 +1292,9 @@
   /* set the SMTP mail receiver(s) */
   CINIT(MAIL_RCPT, OBJECTPOINT, 187),
 
+	/* use PRET for FTP down and uploads */
+	CINIT(FTP_USE_PRET, LONG, 188),
+
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
 
diff -x '*Debug*' -x '*vc6*' -x '*ftpget*' -Naur curl-7.20.0-20091227/lib/ftp.c curl-pret/lib/ftp.c
--- curl-7.20.0-20091227/lib/ftp.c	2009-12-15 04:00:04.000000000 +0100
+++ curl-pret/lib/ftp.c	2009-12-27 16:09:14.482320100 +0100
@@ -565,6 +565,7 @@
     "REST",
     "RETR_REST",
     "PORT",
+    "PRET_RETR",
     "PASV",
     "LIST",
     "RETR",
@@ -1090,7 +1091,25 @@
   }
   else {
     /* We have chosen (this is default) to use the PASV (or similar) command */
-    result = ftp_state_use_pasv(conn);
+    if(data->set.ftp_use_pret) {
+      /* The user has requested that we send a PRET command
+         to prepare the server for the upcoming PASV */
+      if(!conn->proto.ftpc.file) {
+				PPSENDF(&conn->proto.ftpc.pp, "PRET %s", data->set.str[STRING_CUSTOMREQUEST]?
+                 data->set.str[STRING_CUSTOMREQUEST]:
+                 (data->set.ftp_list_only?"NLST":"LIST"));
+      }
+      else if(data->set.upload) {
+				PPSENDF(&conn->proto.ftpc.pp, "PRET STOR %s", conn->proto.ftpc.file);
+      }
+      else {
+				PPSENDF(&conn->proto.ftpc.pp, "PRET RETR %s", conn->proto.ftpc.file);
+      }
+      state(conn, FTP_PRET);
+    }
+    else {
+			result = ftp_state_use_pasv(conn);
+    }
   }
   return result;
 }
@@ -2710,6 +2729,14 @@
       result = ftp_state_rest_resp(conn, ftpcode, ftpc->state);
       break;
 
+		case FTP_PRET:
+			if(ftpcode != 200) {
+				failf(data, "PRET command not accepted: %03d", ftpcode);
+        return CURLE_FTP_PRET_FAILED;
+			}
+			result = ftp_state_use_pasv(conn);
+			break;
+
     case FTP_PASV:
       result = ftp_state_pasv_resp(conn, ftpcode);
       break;
diff -x '*Debug*' -x '*vc6*' -x '*ftpget*' -Naur curl-7.20.0-20091227/lib/ftp.h curl-pret/lib/ftp.h
--- curl-7.20.0-20091227/lib/ftp.h	2009-12-13 04:00:04.000000000 +0100
+++ curl-pret/lib/ftp.h	2009-12-27 16:06:48.859991000 +0100
@@ -79,6 +79,7 @@
   FTP_REST, /* when used to check if the server supports it in head-like */
   FTP_RETR_REST, /* when asking for "resume" in for RETR */
   FTP_PORT, /* generic state for PORT, LPRT and EPRT, check count1 */
+  FTP_PRET,
   FTP_PASV, /* generic state for PASV and EPSV, check count1 */
   FTP_LIST, /* generic state for LIST, NLST or a custom list command */
   FTP_RETR,
diff -x '*Debug*' -x '*vc6*' -x '*ftpget*' -Naur curl-7.20.0-20091227/lib/strerror.c curl-pret/lib/strerror.c
--- curl-7.20.0-20091227/lib/strerror.c	2009-07-23 04:00:02.000000000 +0200
+++ curl-pret/lib/strerror.c	2009-12-27 16:08:20.251218300 +0100
@@ -81,6 +81,9 @@
   case CURLE_REMOTE_ACCESS_DENIED:
     return "Access denied to remote resource";
 
+  case CURLE_FTP_PRET_FAILED:
+    return "FTP: The server did not accept the PRET command.";
+
   case CURLE_FTP_WEIRD_PASS_REPLY:
     return "FTP: unknown PASS reply";
 
diff -x '*Debug*' -x '*vc6*' -x '*ftpget*' -Naur curl-7.20.0-20091227/lib/url.c curl-pret/lib/url.c
--- curl-7.20.0-20091227/lib/url.c	2009-12-18 04:00:04.000000000 +0100
+++ curl-pret/lib/url.c	2009-12-27 14:41:35.996551900 +0100
@@ -701,6 +701,7 @@
   set->httpreq = HTTPREQ_GET; /* Default HTTP request */
   set->ftp_use_epsv = TRUE;   /* FTP defaults to EPSV operations */
   set->ftp_use_eprt = TRUE;   /* FTP defaults to EPRT operations */
+  set->ftp_use_pret = FALSE;   /* mainly useful for drftpd servers */
   set->ftp_filemethod = FTPFILE_MULTICWD;
 
   set->dns_cache_timeout = 60; /* Timeout every 60 seconds by default */
@@ -1563,6 +1564,10 @@
     data->set.ftp_use_epsv = (bool)(0 != va_arg(param, long));
     break;
 
+  case CURLOPT_FTP_USE_PRET:
+    data->set.ftp_use_pret = (bool)(0 != va_arg(param, long));
+    break;
+
   case CURLOPT_FTP_SSL_CCC:
     data->set.ftp_ccc = (curl_ftpccc)va_arg(param, long);
     break;
diff -x '*Debug*' -x '*vc6*' -x '*ftpget*' -Naur curl-7.20.0-20091227/lib/urldata.h curl-pret/lib/urldata.h
--- curl-7.20.0-20091227/lib/urldata.h	2009-12-18 04:00:04.000000000 +0100
+++ curl-pret/lib/urldata.h	2009-12-27 14:37:59.156149400 +0100
@@ -1309,6 +1309,7 @@
   bool reuse_fresh;      /* do not re-use an existing connection  */
   bool ftp_use_epsv;     /* if EPSV is to be attempted or not */
   bool ftp_use_eprt;     /* if EPRT is to be attempted or not */
+  bool ftp_use_pret;     /* if PRET is to be used (PRET STOR for uploads and PRET RETR for downloads) */
 
   curl_usessl ftp_ssl;   /* if AUTH TLS is to be attempted etc, for FTP or
                             IMAP or POP3 or others! */
