mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Alexander Krasnostavsky made it possible to make FTP 3rd party transfers with
both source and destination being the same host. It can be useful if you want to move a file on a server or similar.
This commit is contained in:
parent
2f069ad3e2
commit
38b1d96750
4
CHANGES
4
CHANGES
@ -7,6 +7,10 @@
|
|||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
Daniel (19 October 2004)
|
Daniel (19 October 2004)
|
||||||
|
- Alexander Krasnostavsky made it possible to make FTP 3rd party transfers
|
||||||
|
with both source and destination being the same host. It can be useful if
|
||||||
|
you want to move a file on a server or similar.
|
||||||
|
|
||||||
- Guillaume Arluison added CURLINFO_NUM_CONNECTS to allow an app to figure
|
- Guillaume Arluison added CURLINFO_NUM_CONNECTS to allow an app to figure
|
||||||
out how many new connects a previous transfer required.
|
out how many new connects a previous transfer required.
|
||||||
|
|
||||||
|
@ -2189,6 +2189,7 @@ CURLcode Curl_pretransfersec(struct connectdata *conn)
|
|||||||
CURLcode status = CURLE_OK;
|
CURLcode status = CURLE_OK;
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
struct connectdata *sec_conn = NULL; /* secondary connection */
|
struct connectdata *sec_conn = NULL; /* secondary connection */
|
||||||
|
bool reuse_fresh_tmp = data->set.reuse_fresh;
|
||||||
|
|
||||||
/* update data with source host options */
|
/* update data with source host options */
|
||||||
char *url = aprintf( "%s://%s/", conn->protostr, data->set.source_host);
|
char *url = aprintf( "%s://%s/", conn->protostr, data->set.source_host);
|
||||||
@ -2204,12 +2205,22 @@ CURLcode Curl_pretransfersec(struct connectdata *conn)
|
|||||||
data->set.ftpport = data->set.source_port;
|
data->set.ftpport = data->set.source_port;
|
||||||
data->set.userpwd = data->set.source_userpwd;
|
data->set.userpwd = data->set.source_userpwd;
|
||||||
|
|
||||||
|
/* if both remote hosts are the same host - create new connection */
|
||||||
|
if (strequal(conn->host.dispname, data->set.source_host))
|
||||||
|
/* NOTE: this is restored back to the original value after the connect is
|
||||||
|
done */
|
||||||
|
data->set.reuse_fresh = TRUE;
|
||||||
|
|
||||||
/* secondary connection */
|
/* secondary connection */
|
||||||
status = Curl_connect_host(data, &sec_conn);
|
status = Curl_connect_host(data, &sec_conn);
|
||||||
if(CURLE_OK == status) {
|
if(CURLE_OK == status) {
|
||||||
|
sec_conn->sec_conn = NULL; /* important if re-using existing connection
|
||||||
|
to prevent loop */
|
||||||
sec_conn->data = data;
|
sec_conn->data = data;
|
||||||
conn->sec_conn = sec_conn;
|
conn->sec_conn = sec_conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->set.reuse_fresh = reuse_fresh_tmp;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user