aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/ftp.c298
-rw-r--r--lib/sendf.c4
-rw-r--r--lib/transfer.c64
-rw-r--r--lib/url.c42
-rw-r--r--lib/urldata.h7
6 files changed, 10 insertions, 407 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 9958c8e6f..1a0f5fa63 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -48,7 +48,7 @@ INCLUDES = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib
-VERSION=-version-info 3:0:0
+VERSION=-version-info 4:0:0
# This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
diff --git a/lib/ftp.c b/lib/ftp.c
index 48b66b363..924056f57 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -118,12 +118,9 @@ static CURLcode ftp_cwd(struct connectdata *conn, char *path);
static CURLcode ftp_mkd(struct connectdata *conn, char *path);
static CURLcode ftp_cwd_and_mkd(struct connectdata *conn, char *path);
static CURLcode ftp_quit(struct connectdata *conn);
-static CURLcode ftp_3rdparty_pretransfer(struct connectdata *conn);
-static CURLcode ftp_3rdparty_transfer(struct connectdata *conn);
static CURLcode ftp_parse_url_path(struct connectdata *conn);
static CURLcode ftp_cwd_and_create_path(struct connectdata *conn);
static CURLcode ftp_regular_transfer(struct connectdata *conn, bool *done);
-static CURLcode ftp_3rdparty(struct connectdata *conn);
static void ftp_pasv_verbose(struct connectdata *conn,
Curl_addrinfo *ai,
char *newhost, /* ascii version */
@@ -2962,10 +2959,6 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
*/
return CURLE_OK;
-
- if (conn->sec_path)
- path_to_use = conn->sec_path;
-
/* now store a copy of the directory we are in */
if(ftpc->prevpath)
free(ftpc->prevpath);
@@ -3098,11 +3091,6 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
ftp->no_transfer = FALSE;
ftpc->dont_check = FALSE;
- if (!result && conn->sec_conn) { /* 3rd party transfer */
- /* "done" with the secondary connection */
- result = Curl_ftp_done(conn->sec_conn, status);
- }
-
/* Send any post-transfer QUOTE strings? */
if(!status && !result && data->set.postquote)
result = ftp_sendquote(conn, data->set.postquote);
@@ -3149,40 +3137,6 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
/***********************************************************************
*
- * ftp_transfertype()
- *
- * Set transfer type. We only deal with ASCII or BINARY so this function
- * sets one of them.
- */
-static CURLcode ftp_transfertype(struct connectdata *conn,
- bool ascii)
-{
- struct SessionHandle *data = conn->data;
- int ftpcode;
- ssize_t nread;
- CURLcode result;
-
- FTPSENDF(conn, "TYPE %c", ascii?'A':'I');
-
- result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
- if(result)
- return result;
-
- if(ftpcode != 200) {
- failf(data, "Couldn't set %s mode",
- ascii?"ASCII":"binary");
- return ascii? CURLE_FTP_COULDNT_SET_ASCII:CURLE_FTP_COULDNT_SET_BINARY;
- }
-
- /* keep track of our current transfer type */
- conn->proto.ftpc.transfertype = ascii?'A':'I';
-
- return CURLE_OK;
-}
-
-
-/***********************************************************************
- *
* ftp_need_type()
*
* Returns TRUE if we in the current situation should send TYPE
@@ -3428,13 +3382,7 @@ CURLcode Curl_ftp(struct connectdata *conn, bool *done)
if (retcode)
return retcode;
- if (conn->sec_conn) {
- /* 3rd party transfer */
- *done = TRUE; /* BLOCKING */
- retcode = ftp_3rdparty(conn);
- }
- else
- retcode = ftp_regular_transfer(conn, done);
+ retcode = ftp_regular_transfer(conn, done);
return retcode;
}
@@ -3720,182 +3668,6 @@ static CURLcode ftp_cwd_and_mkd(struct connectdata *conn, char *path)
return result;
}
-
-
-/***********************************************************************
- *
- * ftp_3rdparty_pretransfer()
- *
- * Preparation for 3rd party transfer.
- *
- */
-static CURLcode ftp_3rdparty_pretransfer(struct connectdata *conn)
-{
- CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
- struct connectdata *sec_conn = conn->sec_conn;
-
- conn->xfertype = TARGET3RD;
- sec_conn->xfertype = SOURCE3RD;
-
- /* sets transfer type */
- result = ftp_transfertype(conn, data->set.prefer_ascii);
- if (result)
- return result;
-
- result = ftp_transfertype(sec_conn, data->set.prefer_ascii);
- if (result)
- return result;
-
- /* Send any PREQUOTE strings after transfer type is set? */
- if (data->set.source_prequote) {
- /* sends command(s) to source server before file transfer */
- result = ftp_sendquote(sec_conn, data->set.source_prequote);
- }
- if (!result && data->set.prequote)
- result = ftp_sendquote(conn, data->set.prequote);
-
- return result;
-}
-
-
-
-/***********************************************************************
- *
- * ftp_3rdparty_transfer()
- *
- * Performs 3rd party transfer.
- *
- */
-static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
-{
- CURLcode result = CURLE_OK;
- ssize_t nread;
- int ftpcode, ip[4], port[2];
- struct SessionHandle *data = conn->data;
- struct connectdata *sec_conn = conn->sec_conn;
- char *buf = data->state.buffer; /* this is our buffer */
- char *str = buf;
- char pasv_port[50];
- const char *stor_cmd;
- struct connectdata *pasv_conn;
- struct connectdata *port_conn;
-
- char *path = data->reqdata.path;
-
- if (data->set.ftpport == NULL) {
- pasv_conn = conn;
- port_conn = sec_conn;
- }
- else {
- pasv_conn = sec_conn;
- port_conn = conn;
- }
-
- if (sec_conn->sec_path)
- path = sec_conn->sec_path;
-
- result = ftp_cwd_and_create_path(conn);
- if (result)
- return result;
-
- /* sets the passive mode */
- FTPSENDF(pasv_conn, "%s", "PASV");
- result = Curl_GetFTPResponse(&nread, pasv_conn, &ftpcode);
- if (result)
- return result;
-
- if (ftpcode != 227) {
- failf(data, "Odd return code after PASV: %03d", ftpcode);
- return CURLE_FTP_WEIRD_PASV_REPLY;
- }
-
- while (*str) {
- if (6 == sscanf(str, "%d,%d,%d,%d,%d,%d",
- &ip[0], &ip[1], &ip[2], &ip[3], &port[0], &port[1]))
- break;
- str++;
- }
-
- if (!*str) {
- failf(pasv_conn->data, "Couldn't interpret the 227-reply");
- return CURLE_FTP_WEIRD_227_FORMAT;
- }
-
- snprintf(pasv_port, sizeof(pasv_port), "%d,%d,%d,%d,%d,%d", ip[0], ip[1],
- ip[2], ip[3], port[0], port[1]);
-
- /* sets data connection between remote hosts */
- FTPSENDF(port_conn, "PORT %s", pasv_port);
- result = Curl_GetFTPResponse(&nread, port_conn, &ftpcode);
- if (result)
- return result;
-
- if (ftpcode != 200) {
- failf(data, "PORT command attempts failed: %03d", ftpcode);
- return CURLE_FTP_PORT_FAILED;
- }
-
- /* we might append onto the file instead of overwriting it */
- stor_cmd = data->set.ftp_append?"APPE":"STOR";
-
- /* transfers file between remote hosts */
- /* FIX: this should send a series of CWD commands and then RETR only the
- ftp->file file. The conn->data->reqdata.path "full path" is not
- unescaped. Test case 230 tests this. */
- FTPSENDF(sec_conn, "RETR %s", path);
-
- if(!data->set.ftpport) {
-
- result = Curl_GetFTPResponse(&nread, sec_conn, &ftpcode);
- if (result)
- return result;
-
- if((ftpcode != 150) && (ftpcode != 125)) {
- failf(data, "Failed RETR: %03d", ftpcode);
- return CURLE_FTP_COULDNT_RETR_FILE;
- }
-
- result = Curl_ftpsendf(conn, "%s %s", stor_cmd,
- data->reqdata.proto.ftp->file);
- if(CURLE_OK == result)
- result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
- if (result)
- return result;
-
- if (ftpcode >= 400) {
- failf(data, "Failed FTP upload: %03d", ftpcode);
- return CURLE_FTP_COULDNT_STOR_FILE;
- }
-
- }
- else {
-
- result = Curl_ftpsendf(conn, "%s %s", stor_cmd,
- data->reqdata.proto.ftp->file);
- if(CURLE_OK == result)
- result = Curl_GetFTPResponse(&nread, sec_conn, &ftpcode);
- if (result)
- return result;
-
- if (ftpcode >= 400) {
- failf(data, "Failed FTP upload: %03d", ftpcode);
- return CURLE_FTP_COULDNT_STOR_FILE;
- }
-
- result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
- if (result)
- return result;
-
- if((ftpcode != 150) && (ftpcode != 125)) {
- failf(data, "Failed FTP upload: %03d", ftpcode);
- return CURLE_FTP_COULDNT_STOR_FILE;
- }
- }
-
- return CURLE_OK;
-}
-
/***********************************************************************
*
* ftp_parse_url_path()
@@ -3916,10 +3688,6 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
char *path_to_use = data->reqdata.path;
char *cur_pos;
- if (conn->sec_path) {
- path_to_use = conn->sec_path;
- }
-
cur_pos = path_to_use; /* current position in path. point at the begin
of next path component */
@@ -4056,44 +3824,6 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
return retcode;
}
-
-
-/***********************************************************************
- *
- * ftp_cwd_and_create_path()
- *
- * Creates full path on remote target host.
- *
- */
-static
-CURLcode ftp_cwd_and_create_path(struct connectdata *conn)
-{
- CURLcode result = CURLE_OK;
- struct ftp_conn *ftpc = &conn->proto.ftpc;
- int i;
-
- if(ftpc->cwddone)
- /* already done and fine */
- return CURLE_OK;
-
- /* This is a re-used connection. Since we change directory to where the
- transfer is taking place, we must now get back to the original dir
- where we ended up after login: */
- if (conn->bits.reuse && ftpc->entrypath) {
- if ((result = ftp_cwd_and_mkd(conn, ftpc->entrypath)) != CURLE_OK)
- return result;
- }
-
- for (i=0; i < ftpc->dirdepth; i++) {
- /* RFC 1738 says empty components should be respected too, but
- that is plain stupid since CWD can't be used with an empty argument */
- if ((result = ftp_cwd_and_mkd(conn, ftpc->dirs[i])) != CURLE_OK)
- return result;
- }
-
- return result;
-}
-
/* call this when the DO phase has completed */
static CURLcode ftp_dophase_done(struct connectdata *conn,
bool connected)
@@ -4188,30 +3918,4 @@ CURLcode ftp_regular_transfer(struct connectdata *conn,
return result;
}
-
-
-/***********************************************************************
- *
- * ftp_3rdparty()
- *
- * The input argument is already checked for validity.
- * Performs a 3rd party transfer between two remote hosts.
- */
-static CURLcode ftp_3rdparty(struct connectdata *conn)
-{
- struct Curl_transfer_keeper *k = &conn->data->reqdata.keep;
- CURLcode result = CURLE_OK;
-
- /* both control connections start out fine */
- conn->proto.ftpc.ctl_valid = TRUE;
- conn->sec_conn->proto.ftpc.ctl_valid = TRUE;
- k->size = -1;
-
- result = ftp_3rdparty_pretransfer(conn);
- if (!result)
- result = ftp_3rdparty_transfer(conn);
-
- return result;
-}
-
#endif /* CURL_DISABLE_FTP */
diff --git a/lib/sendf.c b/lib/sendf.c
index 7988d767d..16fa9b0b2 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -590,9 +590,7 @@ int Curl_debug(struct SessionHandle *data, curl_infotype type,
}
if(t) {
- snprintf(buffer, sizeof(buffer), "[%s %s %s%s]", w, t,
- conn->xfertype==NORMAL?"":
- (conn->xfertype==SOURCE3RD?"source ":"target "),
+ snprintf(buffer, sizeof(buffer), "[%s %s %s]", w, t,
conn->host.dispname);
rc = showit(data, CURLINFO_TEXT, buffer, strlen(buffer));
if(rc)
diff --git a/lib/transfer.c b/lib/transfer.c
index 7436a9c66..ded1d5573 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -2247,13 +2247,6 @@ CURLcode Curl_perform(struct SessionHandle *data)
res = Curl_connect_host(data, &conn); /* primary connection */
if(res == CURLE_OK) {
- if (data->set.source_url) /* 3rd party transfer */
- res = Curl_second_connect(conn);
- else
- conn->sec_conn = NULL;
- }
-
- if(res == CURLE_OK) {
bool do_done;
if(data->set.connect_only) {
/* keep connection open for application to use the socket */
@@ -2263,8 +2256,7 @@ CURLcode Curl_perform(struct SessionHandle *data)
}
res = Curl_do(&conn, &do_done);
- /* for non 3rd party transfer only */
- if(res == CURLE_OK && !data->set.source_url) {
+ if(res == CURLE_OK) {
res = Transfer(conn); /* now fetch that URL please */
if(res == CURLE_OK) {
retry = Curl_retry_request(conn, &newurl);
@@ -2382,57 +2374,3 @@ Curl_setup_transfer(
return CURLE_OK;
}
-
-/*
- * Curl_second_connect() makes the secondary connection (used for 3rd party
- * FTP transfers).
- */
-CURLcode Curl_second_connect(struct connectdata *conn)
-{
- CURLcode status = CURLE_OK;
- struct SessionHandle *data = conn->data;
- struct connectdata *sec_conn = NULL; /* secondary connection */
- bool backup_reuse_fresh = data->set.reuse_fresh;
- char *backup_userpwd = data->set.userpwd;
- char *backup_path = data->reqdata.path;
- char *backup_pathbuffer = data->reqdata.pathbuffer;
-
- if(data->change.url_alloc)
- free(data->change.url);
-
- data->change.url_alloc = FALSE;
- data->change.url = data->set.source_url;
-
- /* We must never actually alter 'data->set' properties, so we restore the
- backed up values afterwards! */
-
-#if 0
- /* if both remote hosts are the same host - create new connection */
- if (strequal(conn->host.dispname, data->set.source_host))
-#endif
- data->set.reuse_fresh = TRUE;
-
- data->set.userpwd = data->set.source_userpwd;
-
- /* secondary connection */
- status = Curl_connect_host(data, &sec_conn);
- if(CURLE_OK == status) {
- sec_conn->sec_conn = NULL; /* important if re-using existing connection
- to prevent loop */
- sec_conn->data = data;
- conn->sec_conn = sec_conn;
- }
-
- data->set.reuse_fresh = backup_reuse_fresh;
- data->set.userpwd = backup_userpwd;
-
- /* Copy the source path into a separate place */
- sec_conn->sec_path = data->reqdata.path;
- sec_conn->sec_pathbuffer = data->reqdata.pathbuffer;
-
- /* Restore the original */
- data->reqdata.path = backup_path;
- data->reqdata.pathbuffer = backup_pathbuffer;
-
- return status;
-}
diff --git a/lib/url.c b/lib/url.c
index 968421079..7bcb9822c 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1618,42 +1618,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->set.tcp_nodelay = (bool)(0 != va_arg(param, long));
break;
- /*********** 3rd party transfer options ***********/
- case CURLOPT_SOURCE_URL:
/*
- * SOURCE URL
- */
- data->set.source_url = va_arg(param, char *);
- data->set.printhost = (bool)(NULL != data->set.source_url);
- break;
-
- case CURLOPT_SOURCE_USERPWD:
- /*
- * Use SOURCE USER[:PASSWORD]
- */
- data->set.source_userpwd = va_arg(param, char *);
- break;
-
- case CURLOPT_SOURCE_QUOTE:
- /*
- * List of RAW FTP commands to use after a connect
- */
- data->set.source_quote = va_arg(param, struct curl_slist *);
- break;
-
- case CURLOPT_SOURCE_PREQUOTE:
- /*
- * List of RAW FTP commands to use before a transfer on the source host
- */
- data->set.source_prequote = va_arg(param, struct curl_slist *);
- break;
-
- case CURLOPT_SOURCE_POSTQUOTE:
- /*
- * List of RAW FTP commands to use after a transfer on the source host
- */
- data->set.source_postquote = va_arg(param, struct curl_slist *);
- break;
+ case CURLOPT_SOURCE_URL:
+ case CURLOPT_SOURCE_USERPWD:
+ case CURLOPT_SOURCE_QUOTE:
+ case CURLOPT_SOURCE_PREQUOTE:
+ case CURLOPT_SOURCE_POSTQUOTE:
+ These former 3rd party transfer options are deprecated */
case CURLOPT_FTP_ACCOUNT:
data->set.ftp_account = va_arg(param, char *);
@@ -1726,7 +1697,6 @@ static void conn_free(struct connectdata *conn)
Curl_safefree(conn->allocptr.cookiehost);
Curl_safefree(conn->ip_addr_str);
Curl_safefree(conn->trailer);
- Curl_safefree(conn->sec_pathbuffer);
Curl_safefree(conn->host.rawalloc); /* host name buffer */
Curl_safefree(conn->proxy.rawalloc); /* proxy name buffer */
diff --git a/lib/urldata.h b/lib/urldata.h
index 875dd0032..f701fe96c 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -834,13 +834,6 @@ struct connectdata {
struct Curl_async async;
#endif
- struct connectdata *sec_conn; /* secondary connection for 3rd party
- transfer */
- char *sec_path; /* The source path for FTP 3rd party */
- char *sec_pathbuffer;
-
- enum { NORMAL, SOURCE3RD, TARGET3RD } xfertype;
-
/* These three are used for chunked-encoding trailer support */
char *trailer; /* allocated buffer to store trailer in */
int trlMax; /* allocated buffer size */