cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: optimizing TYPE in FTP

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 9 Aug 2006 22:40:20 +0200 (CEST)

On Wed, 9 Aug 2006, Armel Asselin wrote:

> I'm currently optimizing the usage of FTP TYPE command (sending the command
> only if really changing).
> I currently changed SessionHandle::ftp_in_ascii_mode and move it to
> FTP::transfer_type (A / I or zero when never set)
>
> in sendf.c:Curl_client_write:381 the ftp_in_ascii_mode was used to know if
> conversions should be used. but now this variable is moved in FTP struct,
> what is the official way to access the FTP struct?

The "offical way" is that to be able to do that you must know what connection
(connectdata struct) it is and then you simply access the member in that
struct named 'ftp'.

If you only have the 'data' (SessionHandle) pointer, you just can't access the
FTP struct.

I guess it forces you to add a 'conn' pointer to the Curl_client_write()
prototype...

> I used:
> data->state.connects[0]->proto.ftp
>
> but i'm pretty sure that it is not perfect.

Not only imperfect but a completely flawed approach. Do not assume that you
only and always will use the first connection, as that is not true.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-08-09