Commit 7e42cb61 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

FTP third transfer support overhaul. See CHANGES for details.

parent 6c038680
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -7,6 +7,50 @@
                                  Changelog


Daniel (21 January 2005)
- Major FTP third party transfer overhaul.

  These four options are now obsolete: CURLOPT_SOURCE_HOST,
  CURLOPT_SOURCE_PATH, CURLOPT_SOURCE_PORT (this option didn't work before)
  and CURLOPT_PASV_HOST.

  These two options are added: CURLOPT_SOURCE_URL and CURLOPT_SOURCE_QUOTE.

  The target-side didn't use the proper path with RETR, and thus this only
  worked correctly in the login path (i.e without doing any CWD). The source-
  side still uses a wrong path, but the fix for this will need to wait. Verify
  the flaw by using a source URL with included %XX-codes.

  Made CURLOPT_FTPPORT control weather the target operation should use PORT
  (or not). The other side thus uses passive (PASV) mode.

  Updated the ftp3rdparty.c example source to use the updated options.

  Added support for a second FTP server in the test suite. Named... ftp2.
  Added test cases 230, 231 and 232 as a few first basic tests of very simple
  3rd party transfers.

  Changed the debug output to include 'target' and 'source' when a 3rd party
  is being made, to make it clearer what commands/responses came on what
  connection.

  Added three new command line options: --3p-url, --3p-user and --3p-quote.

  Documented the command line options and the curl_easy_setopt options related
  to third party transfers.

  (Temporarily) disabled the ability to re-use an existing connection for the
  source connection. This is because it needs to force a new in case the
  source and target is the same host, and the host name check is trickier now
  when the source is identified with a full URL instead of a plain host name
  like before.

  TODO (short-term) for 3rd party transfers: quote support. The options are
  there, we need to add test cases to verify their functionality.

  TODO (long-term) for 3rd party transfers: IPv6 support (EPRT and EPSV etc)
  and SSL/TSL support.

Daniel (20 January 2005)
- Philippe Hameau found out that -Q "+[command]" didn't work, although some
  code was written for it. I fixed and added test case 227 to verify it.
+7 −2
Original line number Diff line number Diff line
Curl and libcurl 7.12.4
Curl and libcurl 7.13.0

 Public curl release number:               85
 Releases counted from the very beginning: 112
 Available command line options:           100
 Available command line options:           103
 Available curl_easy_setopt() options:     123
 Number of public functions in libcurl:    46
 Amount of public web site mirrors:        14
@@ -10,6 +10,10 @@ Curl and libcurl 7.12.4

This release includes the following changes:

 o added CURLOPT_SOURCE_URL and CURLOPT_SOURCE_QUOTE
 o obsoleted CURLOPT_SOURCE_HOST, CURLOPT_SOURCE_PATH, CURLOPT_SOURCE_PORT
   and CURLOPT_PASV_HOST
 o added --3p-url, --3p-user and --3p-quote
 o -Q "+[command]" was added
 o src/getpass.c license issue sorted (code was rewritten)
 o curl -w now supports 'http_connect' for the proxy's response to CONNECT
@@ -17,6 +21,7 @@ This release includes the following changes:

This release includes the following bugfixes:

 o FTP third party transfers was much improved
 o proxy environment variables are now ignored when built HTTP-disabled
 o CURLOPT_PROXY can now disable HTTP proxy even when built HTTP-disabled
 o "curl dictionary.com" no longer assumes DICT protocol
+12 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
.\" * $Id$
.\" **************************************************************************
.\"
.TH curl 1 "20 Jan 2005" "Curl 7.12.4" "Curl Manual"
.TH curl 1 "20 Jan 2005" "Curl 7.13.0" "Curl Manual"
.SH NAME
curl \- transfer a URL
.SH SYNOPSIS
@@ -1065,6 +1065,17 @@ Forces curl to use SSL version 2 when negotiating with a remote SSL server.
.IP "-3/--sslv3"
(HTTPS)
Forces curl to use SSL version 3 when negotiating with a remote SSL server.
.IP "--3p-quote"
(FTP) Specify arbitrary commands to send to the source server. See the
\fI-Q/--quote\fP option for details. (Added in 7.13.0)
.IP "--3p-url"
(FTP) Activates a FTP 3rd party transfer. Specifies the source URL to get a
file from, while the "normal" URL will be used as target URL, the file that
will be written/created.

Note that not all FTP server allow 3rd party transfers. (Added in 7.13.0)
.IP "--3p-user"
(FTP) Specify user:password for the source URL transfer. (Added in 7.13.0)
.IP "-4/--ipv4"
If libcurl is capable of resolving an address to multiple IP versions (which
it is if it is ipv6-capable), this option tells libcurl to resolve names to
+23 −24
Original line number Diff line number Diff line
@@ -16,18 +16,16 @@

/*
 * This is an example showing how to transfer a file between two remote hosts.
 * 7.13.0 or later required.
 */



int main(void)
{
  CURL *curl;
  CURLcode res;
  char sourceFileName[] = "/tmp/file";
  char targetFileName[] = "/tmp/curlTargetTest.dat";
  char sourceHost[] = "source";
  char targetHost[] = "target";
  char source_url[] = "ftp://remotehost.com/path/to/source";
  char target_url[] = "ftp://aotherserver.com/path/to/dest";

  char sourceUserPass[] = "user:pass";
  char targetUserPass[] = "user:pass";
  char url[100];
@@ -42,21 +40,22 @@ int main(void)

  curl = curl_easy_init();
  if (curl) {
    sprintf(url, "ftp://%s@%s/%s", targetUserPass, targetHost, targetFileName);
    printf("%s\n", url);
    curl_easy_setopt(curl, CURLOPT_URL, url);
    /* The ordinary URL is the target when speaking 3rd party transfers */
    curl_easy_setopt(curl, CURLOPT_URL, target_url);

    /* Set a proxy host */
    curl_easy_setopt(curl, CURLOPT_SOURCE_HOST, sourceHost);
    /* Set a source URL */
    curl_easy_setopt(curl, CURLOPT_SOURCE_URL, source_url);

    /* Set a proxy user and password */
    curl_easy_setopt(curl, CURLOPT_SOURCE_USERPWD, sourceUserPass);
    /* Set target user and password */
    curl_easy_setopt(curl, CURLOPT_USERPWD, targetUserPass);

    /* Set a proxy full file name */
    curl_easy_setopt(curl, CURLOPT_SOURCE_PATH, sourceFileName);
    /* Set source user and password */
    curl_easy_setopt(curl, CURLOPT_SOURCE_USERPWD, sourceUserPass);

    /* Set a proxy passive host */
    curl_easy_setopt(curl, CURLOPT_PASV_HOST, 0);   /* optional */
#if 0
    /* FTPPORT enables PORT on the target side, instead of PASV. */
    curl_easy_setopt(curl, CURLOPT_FTPPORT, "");   /* optional */
#endif

    /* build a list of commands to pass to libcurl */
    source_pre_cmd = curl_slist_append(source_pre_cmd, cmd);
+14 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
.\" *                            | (__| |_| |  _ <| |___
.\" *                             \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
.\" * $Id$
.\" **************************************************************************
.\"
.TH curl_easy_setopt 3 "29 Nov 2004" "libcurl 7.12.3" "libcurl Manual"
.TH curl_easy_setopt 3 "20 Jan 2005" "libcurl 7.12.4" "libcurl Manual"
.SH NAME
curl_easy_setopt - set options for a curl easy handle
.SH SYNOPSIS
@@ -751,6 +751,18 @@ Try "AUTH SSL" first, and only if that fails try "AUTH TLS"
.IP CURLFTPAUTH_TLS
Try "AUTH TLS" first, and only if that fails try "AUTH SSL"
.RE
.IP CURLOPT_SOURCE_URL
When set, it enables a FTP third party transfer, using the set URL as source,
while \fICURLOPT_URL\fP is the target.
.IP CURLOPT_SOURCE_USERPWD
Set "username:password" to use for the source connection when doing FTP third
party transfers.
.IP CURLOPT_SOURCE_QUOTE
Exactly like \fICURLOPT_QUOTE\fP, but for the source host.
.IP CURLOPT_SOURCE_PREQUOTE
Exactly like \fICURLOPT_PREQUOTE\fP, but for the source host.
.IP CURLOPT_SOURCE_POSTQUOTE
Exactly like \fICURLOPT_POSTQUOTE\fP, but for the source host.
.SH PROTOCOL OPTIONS
.IP CURLOPT_TRANSFERTEXT
A non-zero parameter tells the library to use ASCII mode for ftp transfers,
Loading