curl-library
Re: ftp connect exception error
Date: Tue, 15 Mar 2005 14:27:19 +0000
yeah, i think i find the reason.
in the ftp.c file, in the
CURLcode ftp_regular_transfer(struct connectdata *conn), code like this
...
/* the ftp struct is already inited in ftp_connect() */
ftp = conn->proto.ftp;
...
retcode = ftp_perform(conn, &connected);
...
if(CURLE_OK == retcode) {
...
}
else
freedirs(ftp);
ftp_perform works fine, it return the error code 15, but in
Curl_wait_for_resolv(hostthre.c) which is indirectly called by ftp_perform,
the following line :
if(CURLE_OK != rc)
/* close the connection, since we must not return failure from here
without cleaning up this connection properly */
Curl_disconnect(conn);
then in Curl_disconnect(url.c), the following line is performed:
Curl_safefree(conn->proto.generic);
and this frees the conn->proto memory, so in the ftp_regular_transfer, the
pointer ftp
points to a non-allocated memory. because the retcode is not CURLE_OK, so
freedirs(ftp)
is called, in the freedirs:
free(ftp->dirs);
failed, because ftp->dirs does not exist now.
>From: Daniel Stenberg <daniel-curl_at_haxx.se>
>Reply-To: libcurl development <curl-library_at_cool.haxx.se>
>To: libcurl development <curl-library_at_cool.haxx.se>
>Subject: Re: ftp connect exception error
>Date: Tue, 15 Mar 2005 13:38:26 +0100 (CET)
>
>On Tue, 15 Mar 2005, luan xl wrote:
>
>>227 Entering Passiv Mode (1218,91,214,51,8,55)
>
>Hehe, this is one major bad server you've found!
>
>>so i guess libcurl do not handle this exception well.
>>
>>my enviroment is: Win2K3 + VC6.0 SP5 + libcurl 7.13.0
>
>I find that interesting. I just added a test case (number 237) that
>makes almost exactly this error and it works as expected on Linux. I
>checked the code for Windows too, but I can't see any obvious
>mistakes.
>
>Since you have a way to repeat this, can you run this with a
>debugger to closely check where the exception occurs inside libcurl?
>
>--
> Daniel Stenberg -- http://curl.haxx.se --
>http://daniel.haxx.se
> Dedicated custom curl help for hire: http://haxx.se/curl.html
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
Received on 2005-03-15