cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Why doesn't set CURLFTP_CREATE_DIR_RETRY when run “curl --ftp-create-dirs”

From: Leif W <warp9pnt9_at_gmail.com>
Date: Fri, 22 Apr 2016 11:24:40 -0400

On 2016-04-22 09:43, Rich Gray wrote:
> Daniel Stenberg wrote:
>> Two alternatives we have are:
>>
>> 1. have --ftp-create-dirs set CURLOPT_FTP_CREATE_MISSING_DIRS to 2
>> unconditionally
>>
>> 2. add a new option that can replace the existing one that allows you
>> to set
>> level, or possibly one that sets it to 2 and leave the original one
>> set it
>> it to 1.
>
> How about simply adding --ftp-create_dirs2 ?? Normally, I would
> consider adding the parm at the end of the option to be hokey, but here
> it kind of fits in that the operation is tried twice. Leaves existing
> behavior alone and is a trivial option add.

While thinking of this, I wondered what happens if someone specifies
both? Then there are two options competing to change the same thing,
but as --ftp-create-dirs-retry.

         my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
                   config->ftp_create_dirs?1L:0L);

         my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
                   config->ftp_create_dirs-retry?2L:0L);

Both modifying libcurl's CURLOPT_FTP_CREATE_MISSING_DIRS, but which one
is intended, which goes first, does it always go first, etc? I am not
yet familiar with the options, but how much work is it to set up
mutually exclusive options so that they can't both be called?

Otherwise maybe it'd mean digging further into libcurl to add
CURLOPT_FTP_CREATE_MISSING_DIRS_RETRY to push the separation deeper into
the lib? Means fiddling with function logic and calls or perhaps
separation of a function into two functions, duplication of code and
behavior, testing...

Seems like a lot of work with little return, when the alternative,
change one character, should suffice with (hopefully) negligible side
effects (at worst, a few extra ms for a command with a seldom used
option that would have failed anyways).

However, I am not yet very familiar with the code, so I am not an
authority, just offering observations and initial thoughts, which may or
may not be on the right track. :) But I think, try the simplest
solution first, and if it isn't enough (i.e. generates support noise),
then revisit the idea of a second option.

-- 
Leif
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ:        https://curl.haxx.se/docs/faq.html
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-04-22