cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: FTP third party transfer (proxy) support.

From: Alexander Krasnostavsky <ALEXANDERKR_at_Amdocs.com>
Date: Sun, 30 May 2004 10:28:27 +0300

Hi Daniel,
I think I found a bug in the original code when I have tested reuse with
FTP 3rd party transfer.
In file url.c in function CreateConnection() (which is too big to handle
easily) when reusing a connection by the following reassignment:
conn = conn_temp; /* use this connection from now on */

the changed user data is not transferred to the old connection.
For example, a user wants to perform some prequote at the first transfer
and cancel or change this to another one at the second transfer:

curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
...
curl_easy_setopt(curl, CURLOPT_PREQUOTE, pre_cmd);
res = curl_easy_perform(curl); /* the first transfer */
...
curl_slist_free_all(pre_cmd);
curl_easy_setopt(curl, CURLOPT_PREQUOTE, NULL);
res = curl_easy_perform(curl); /* the second transfer - cause coredump
because pre_cmd was freed */
...
curl_easy_cleanup(curl);

This is true for every user option except the URL (host, user:passwd,
path).

So I add the following before line "Curl_safefree(old_conn->user);" :
    /* it is important to update user's options */
    memcpy(&(conn->data->set), &(old_conn->data->set), sizeof(struct
UserDefined));

All the user data always should be copied to the old connection.
It is works now in my reuse tests.

The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged.
The information is intended to be conveyed only to the designated recipient(s)
of the message. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, use, distribution or copying of
this communication is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.
Thank you.
Received on 2004-05-30