? 3rdpartytest.patch
? libcurl.pc
? myconfigure
? src/config.h.in
? tests/data/test520
? tests/libtest/lib520.c
Index: docs/examples/ftp3rdparty.c
===================================================================
RCS file: /cvsroot/curl/curl/docs/examples/ftp3rdparty.c,v
retrieving revision 1.1
diff -u -r1.1 ftp3rdparty.c
--- docs/examples/ftp3rdparty.c	3 Jun 2004 11:15:27 -0000	1.1
+++ docs/examples/ftp3rdparty.c	16 Jan 2005 08:42:45 -0000
@@ -1,8 +1,8 @@
 /*****************************************************************************
- *                                  _   _ ____  _     
- *  Project                     ___| | | |  _ \| |    
- *                             / __| | | | |_) | |    
- *                            | (__| |_| |  _ <| |___ 
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
  * $Id: ftp3rdparty.c,v 1.1 2004/06/03 11:15:27 bagder Exp $
@@ -31,7 +31,7 @@
   char sourceUserPass[] = "user:pass";
   char targetUserPass[] = "user:pass";
   char url[100];
-  
+
   struct curl_slist *source_pre_cmd = NULL;
   struct curl_slist *target_pre_cmd = NULL;
   struct curl_slist *source_post_cmd = NULL;
@@ -39,7 +39,7 @@
   char cmd[] = "PWD";   /* just to test */
 
   curl_global_init(CURL_GLOBAL_DEFAULT);
-  
+
   curl = curl_easy_init();
   if (curl) {
     sprintf(url, "ftp://%s@%s/%s", targetUserPass, targetHost, targetFileName);
@@ -77,7 +77,7 @@
     target_post_cmd = curl_slist_append(target_post_cmd, cmd);
     /* Set a post-quote command */
     curl_easy_setopt(curl, CURLOPT_POSTQUOTE, target_post_cmd);
-    
+
     /* Switch on full protocol/debug output */
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
 
Index: src/main.c
===================================================================
RCS file: /cvsroot/curl/curl/src/main.c,v
retrieving revision 1.304
diff -u -r1.304 main.c
--- src/main.c	6 Jan 2005 22:54:37 -0000	1.304
+++ src/main.c	16 Jan 2005 08:42:47 -0000
@@ -400,13 +400,12 @@
     "    --socks <host[:port]> Use SOCKS5 proxy on given host + port",
     "    --stderr <file> Where to redirect stderr. - means stdout",
     " -t/--telnet-option <OPT=val> Set telnet option",
-    "    --trace <file>  Dump a network/debug trace to the given file",
+    "    --trace <file>  Write a debug trace to the given file",
     "    --trace-ascii <file> Like --trace but without the hex output",
-    " -T/--upload-file <file> Transfer/upload <file> to remote site",
-    "    --url <URL>     Another way to specify URL to work with",
-    " -u/--user <user[:password]> Specify user and password to use",
-    "                    Overrides -n and --netrc-optional",
-    " -U/--proxy-user <user[:password]> Specify Proxy authentication",
+    " -T/--upload-file <file> Transfer <file> to remote site",
+    "    --url <URL>     Spet URL to work with",
+    " -u/--user <user[:password]> Set server user and password",
+    " -U/--proxy-user <user[:password]> Set proxy user and password",
     " -v/--verbose       Make the operation more talkative",
     " -V/--version       Show version number and quit",
 #ifdef __DJGPP__
@@ -422,6 +421,12 @@
     " -1/--tlsv1         Use TLSv1 (SSL)",
     " -2/--sslv2         Use SSLv2 (SSL)",
     " -3/--sslv3         Use SSLv3 (SSL)",
+    "    --3rd-host      FIX",
+    "    --3rd-user      FIX",
+    "    --3rd-path      FIX",
+    "    --3rd-quote     FIX",
+    "    --3rd-pasv      FIX",
+    "    --3rd-port      FIX",
     " -4/--ipv4          Resolve name to IPv4 address",
     " -6/--ipv6          Resolve name to IPv6 address",
     " -#/--progress-bar  Display transfer progress as a progress bar",
@@ -540,6 +545,15 @@
   long req_retry;   /* number of retries */
   long retry_delay; /* delay between retries (in seconds) */
   long retry_maxtime; /* maximum time to keep retrying */
+
+  char *thirdhost;
+  char *thirduser;
+  char *thirdpath;
+  struct curl_slist *thirdquote;
+  struct curl_slist *thirdpostquote;
+  struct curl_slist *thirdprequote;
+  long thirdport;
+  long thirdpasv;
 };
 
 /* global variable to hold info about libcurl */
@@ -1240,6 +1254,14 @@
     {"$g", "retry",      TRUE},
     {"$h", "retry-delay", TRUE},
     {"$i", "retry-max-time", TRUE},
+
+    {"$j", "3rd-host", TRUE},
+    {"$k", "3rd-user", TRUE},
+    {"$l", "3rd-path", TRUE},
+    {"$m", "3rd-quote", TRUE},
+    {"$n", "3rd-pasv", TRUE},
+    {"$o", "3rd-port", TRUE},
+
     {"0", "http1.0",     FALSE},
     {"1", "tlsv1",       FALSE},
     {"2", "sslv2",       FALSE},
@@ -1586,6 +1608,26 @@
       case 'i': /* --retry-max-time */
         if(str2num(&config->retry_maxtime, nextarg))
           return PARAM_BAD_NUMERIC;
+        break;
+
+      case 'j': /* --3rd-host */
+        GetStr(&config->thirdhost, nextarg);
+        break;
+      case 'k': /* --3rd-user */
+        GetStr(&config->thirduser, nextarg);
+        break;
+      case 'l': /* --3rd-path */
+        GetStr(&config->thirdpath, nextarg);
+        break;
+      case 'm': /* --3rd-quote */
+        /* FIX */
+        break;
+      case 'n': /* --3rd-pasv */
+        /* FIX */
+        break;
+      case 'o': /* --3rd-port */
+        if(str2num(&config->thirdport, nextarg))
+          return PARAM_BAD_NUMERIC;
         /* break */
       }
       break;
@@ -3602,6 +3644,19 @@
           curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
         }
 
+        /* curl 7.12.4 */
+        curl_easy_setopt(curl, CURLOPT_SOURCE_HOST, config->thirdhost);
+        curl_easy_setopt(curl, CURLOPT_SOURCE_USERPWD, config->thirduser);
+        curl_easy_setopt(curl, CURLOPT_SOURCE_PATH, config->thirdpath);
+        curl_easy_setopt(curl, CURLOPT_SOURCE_PORT, config->thirdport);
+        curl_easy_setopt(curl, CURLOPT_SOURCE_PREQUOTE, config->thirdprequote);
+        curl_easy_setopt(curl, CURLOPT_SOURCE_POSTQUOTE, config->thirdpostquote);
+        curl_easy_setopt(curl, CURLOPT_PASV_HOST, config->thirdpasv);
+#if 0
+        /* Why is there no CURLOPT_SOURCE_QUOTE ? */
+        curl_easy_setopt(curl, CURLOPT_SOURCE_QUOTE, config->thirdquote);
+#endif
+
         retry_numretries = config->req_retry;
 
         retrystart = curlx_tvnow();
Index: tests/ftpserver.pl
===================================================================
RCS file: /cvsroot/curl/curl/tests/ftpserver.pl,v
retrieving revision 1.47
diff -u -r1.47 ftpserver.pl
--- tests/ftpserver.pl	27 Oct 2004 14:18:57 -0000	1.47
+++ tests/ftpserver.pl	16 Jan 2005 08:42:47 -0000
@@ -38,11 +38,13 @@
 
 require "getpart.pm";
 
+my $ftpdnum="";
+
 # open and close each time to allow removal at any time
 sub logmsg {
     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
         localtime(time);
-    open(FTPLOG, ">>log/ftpd.log");
+    open(FTPLOG, ">>log/ftpd$ftpdnum.log");
     printf FTPLOG ("%02d:%02d:%02d ", $hour, $min, $sec);
     print FTPLOG @_;
     close(FTPLOG);
@@ -50,8 +52,8 @@
 
 sub ftpmsg {
   # append to the server.input file
-  open(INPUT, ">>log/server.input") ||
-    logmsg "failed to open log/server.input\n";
+  open(INPUT, ">>log/server$ftpdnum.input") ||
+    logmsg "failed to open log/server$ftpdnum.input\n";
 
   INPUT->autoflush(1);
   print INPUT @_;
@@ -77,6 +79,10 @@
         $srcdir=$ARGV[1];
         shift @ARGV;
     }
+    elsif($ARGV[0] eq "--id") {
+        $ftpdnum=$ARGV[1];
+        shift @ARGV;
+    }
     elsif($ARGV[0] =~ /^(\d+)$/) {
         $port = $1;
     }
@@ -92,7 +98,7 @@
 
 #print "FTP server started on port $port\n";
 
-open(PID, ">.ftp.pid");
+open(PID, ">.ftp$ftpdnum.pid");
 print PID $$;
 close(PID);
 
Index: tests/runtests.pl
===================================================================
RCS file: /cvsroot/curl/curl/tests/runtests.pl,v
retrieving revision 1.158
diff -u -r1.158 runtests.pl
--- tests/runtests.pl	15 Jan 2005 09:21:51 -0000	1.158
+++ tests/runtests.pl	16 Jan 2005 08:42:48 -0000
@@ -40,6 +40,7 @@
 my $HTTP6PORT; # HTTP IPv6 server port
 my $HTTPSPORT; # HTTPS server port
 my $FTPPORT; # FTP server port
+my $FTP2PORT; # FTP server 2 port
 my $FTPSPORT; # FTPS server port
 
 my $CURL="../src/curl"; # what curl executable to run on the tests
@@ -66,6 +67,7 @@
 my $HTTP6PIDFILE=".http6.pid";
 my $HTTPSPIDFILE=".https.pid";
 my $FTPPIDFILE=".ftp.pid";
+my $FTP2PIDFILE=".ftp2.pid";
 my $FTPSPIDFILE=".ftps.pid";
 
 # invoke perl like this:
@@ -487,19 +489,20 @@
 # start the ftp server if needed
 #
 sub runftpserver {
-    my $verbose = $_[0];
+    my ($id, $verbose) = @_;
     my $STATUS;
     my $RUNNING;
+    my $port = $id?$FTP2PORT:$FTPPORT;
     # check for pidfile
-    my $pid = checkserver ($FTPPIDFILE );
+    my $pid = checkserver ($id?$FTP2PIDFILE:$FTPPIDFILE);
 
     if ($pid <= 0) {
-        print "RUN: Check port $FTPPORT for our own FTP server\n"
+        print "RUN: Check port $port for the FTP$id server\n"
             if ($verbose);
 
         my $time=time();
         # check if this is our server running on this port:
-        my @data=`$CURL -m4 --silent ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null`;
+        my @data=`$CURL -m4 --silent ftp://$HOSTIP:$port/verifiedserver 2>/dev/null`;
         my $line;
 
         # if this took more than 2 secs, we assume it "hung" on a weird server
@@ -513,7 +516,7 @@
         }
         if(!$pid && $data[0]) {
             # this is not a known server
-            print "RUN: Unknown server on our favourite FTP port: $FTPPORT\n";
+            print "RUN: Unknown server on our favourite FTP port: $port\n";
             return -1;
         }
     }
@@ -522,7 +525,7 @@
         print "RUN: Killing a previous server using pid $pid\n" if($verbose);
         my $res = kill (9, $pid); # die!
         if(!$res) {
-            print "RUN: Failed to kill our FTP test server, do it manually and",
+            print "RUN: Failed to kill FTP$id test server, do it manually and",
             " restart the tests.\n";
             return -1;
         }
@@ -531,8 +534,11 @@
 
     # now (re-)start our server:
     my $flag=$debugprotocol?"-v ":"";
-    $flag .= "-s \"$srcdir\"";
-    my $cmd="$perl $srcdir/ftpserver.pl $flag $FTPPORT &";
+    $flag .= "-s \"$srcdir\" ";
+    if($id) {
+        $flag .="--id $id ";
+    }
+    my $cmd="$perl $srcdir/ftpserver.pl $flag $port &";
     if($verbose) {
         print "CMD: $cmd\n";
     }
@@ -543,7 +549,7 @@
     for(1 .. 10) {
         # verify that our server is up and running:
         my $line;
-        my $cmd="$CURL --silent ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null";
+        my $cmd="$CURL --silent ftp://$HOSTIP:$port/verifiedserver 2>/dev/null";
         print "$cmd\n" if($verbose);
         my @data = `$cmd`;
         foreach $line (@data) {
@@ -555,7 +561,7 @@
         }
         if(!$pid) {
             if($verbose) {
-                print STDERR "RUN: Retrying FTP server existence in 3 sec\n";
+                print STDERR "RUN: Retrying FTP$id server existence in 3 sec\n";
             }
             sleep(3);
             next;
@@ -565,12 +571,12 @@
         }
     }
     if(!$verified) {
-        warn "RUN: failed to start our FTP server\n";
+        warn "RUN: failed to start our FTP$id server\n";
         return -2;
     }
 
     if($verbose) {
-        print "RUN: FTP server is now verified to be our server\n";
+        print "RUN: FTP$id server is now verified to be our server\n";
     }
 
     return $pid;
@@ -845,6 +851,7 @@
 
     printf("* HTTP port:      %d\n", $HTTPPORT);
     printf("* FTP port:       %d\n", $FTPPORT);
+    printf("* FTP port 2:     %d\n", $FTP2PORT);
     if($stunnel) {
         printf("* FTPS port:      %d\n", $FTPSPORT);
         printf("* HTTPS port:     %d\n", $HTTPSPORT);
@@ -867,6 +874,7 @@
   $$thing =~ s/%HTTP6PORT/$HTTP6PORT/g;
   $$thing =~ s/%HTTPSPORT/$HTTPSPORT/g;
   $$thing =~ s/%FTPPORT/$FTPPORT/g;
+  $$thing =~ s/%FTP2PORT/$FTP2PORT/g;
   $$thing =~ s/%FTPSPORT/$FTPSPORT/g;
   $$thing =~ s/%SRCDIR/$srcdir/g;
   $$thing =~ s/%PWD/$pwd/g;
@@ -1491,7 +1499,7 @@
         $what =~ s/[^a-z0-9-]//g;
         if($what eq "ftp") {
             if(!$run{'ftp'}) {
-                $pid = runftpserver($verbose);
+                $pid = runftpserver("", $verbose);
                 if($pid <= 0) {
                     return "failed starting FTP server";
                 }
@@ -1499,6 +1507,16 @@
                 $run{'ftp'}=$pid;
             }
         }
+        elsif($what eq "ftp2") {
+            if(!$run{'ftp2'}) {
+                $pid = runftpserver("2", $verbose);
+                if($pid <= 0) {
+                    return "failed starting FTP2 server";
+                }
+                printf ("* pid ftp2 => %-5d\n", $pid) if($verbose);
+                $run{'ftp2'}=$pid;
+            }
+        }
         elsif($what eq "http") {
             if(!$run{'http'}) {
                 $pid = runhttpserver($verbose);
@@ -1529,7 +1547,7 @@
                 return "curl lacks SSL support";
             }
             if(!$run{'ftp'}) {
-                $pid = runftpserver($verbose);
+                $pid = runftpserver("", $verbose);
                 if($pid <= 0) {
                     return "failed starting FTP server";
                 }
@@ -1735,6 +1753,7 @@
 $FTPSPORT =  $base + 3; # FTPS server port
 $HTTP6PORT = $base + 4; # HTTP IPv6 server port (different IP protocol
                         # but we follow the same port scheme anyway)
+$FTP2PORT =  $base + 5; # FTP server 2 port
 
 #######################################################################
 # Output curl version and host info being tested
