aboutsummaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-01-21 09:32:32 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-01-21 09:32:32 +0000
commit7e42cb61f75890832792c082510ec610f4c32cbe (patch)
tree3c73a5796491a7ad59dfa1d2e151141d02e276ad /lib/transfer.c
parent6c038680f9a0de30f2a0b60c1e02bfb74006c851 (diff)
FTP third transfer support overhaul. See CHANGES for details.
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 344413f0d..71338977d 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -935,7 +935,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN,
- k->p, k->hbuflen, conn->host.dispname);
+ k->p, k->hbuflen, conn);
result = Curl_client_write(data, writetype, k->p, k->hbuflen);
if(result)
@@ -1032,14 +1032,12 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(data->set.verbose) {
if(k->badheader) {
Curl_debug(data, CURLINFO_DATA_IN, data->state.headerbuff,
- k->hbuflen, conn->host.dispname);
+ k->hbuflen, conn);
if(k->badheader == HEADER_PARTHEADER)
- Curl_debug(data, CURLINFO_DATA_IN, k->str, nread,
- conn->host.dispname);
+ Curl_debug(data, CURLINFO_DATA_IN, k->str, nread, conn);
}
else
- Curl_debug(data, CURLINFO_DATA_IN, k->str, nread,
- conn->host.dispname);
+ Curl_debug(data, CURLINFO_DATA_IN, k->str, nread, conn);
}
#ifndef CURL_DISABLE_HTTP
@@ -1270,7 +1268,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(data->set.verbose)
/* show the data before we change the pointer upload_fromhere */
Curl_debug(data, CURLINFO_DATA_OUT, conn->upload_fromhere,
- bytes_written, conn->host.dispname);
+ bytes_written, conn);
if(conn->upload_present != bytes_written) {
/* we only wrote a part of the buffer (if anything), deal with it! */
@@ -2094,7 +2092,7 @@ CURLcode Curl_perform(struct SessionHandle *data)
res = Curl_connect_host(data, &conn); /* primary connection */
if(res == CURLE_OK) {
- if (data->set.source_host) /* 3rd party transfer */
+ if (data->set.source_url) /* 3rd party transfer */
res = Curl_pretransfersec(conn);
else
conn->sec_conn = NULL;
@@ -2105,7 +2103,7 @@ CURLcode Curl_perform(struct SessionHandle *data)
res = Curl_do(&conn);
/* for non 3rd party transfer only */
- if(res == CURLE_OK && !data->set.source_host) {
+ if(res == CURLE_OK && !data->set.source_url) {
res = Transfer(conn); /* now fetch that URL please */
if(res == CURLE_OK) {
@@ -2236,28 +2234,26 @@ CURLcode Curl_pretransfersec(struct connectdata *conn)
CURLcode status = CURLE_OK;
struct SessionHandle *data = conn->data;
struct connectdata *sec_conn = NULL; /* secondary connection */
- bool reuse_fresh_tmp = data->set.reuse_fresh;
-
- /* update data with source host options */
- char *url = aprintf( "%s://%s/", conn->protostr, data->set.source_host);
-
- if(!url)
- return CURLE_OUT_OF_MEMORY;
+ bool backup_reuse_fresh = data->set.reuse_fresh;
+ char *backup_userpwd = data->set.userpwd;
if(data->change.url_alloc)
free(data->change.url);
- data->change.url_alloc = TRUE;
- data->change.url = url;
- data->set.ftpport = data->set.source_port;
- data->set.userpwd = data->set.source_userpwd;
+ 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))
- /* NOTE: this is restored back to the original value after the connect is
- done */
+#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) {
@@ -2267,7 +2263,8 @@ CURLcode Curl_pretransfersec(struct connectdata *conn)
conn->sec_conn = sec_conn;
}
- data->set.reuse_fresh = reuse_fresh_tmp;
+ data->set.reuse_fresh = backup_reuse_fresh;
+ data->set.userpwd = backup_userpwd;
return status;
}