curl-users
Re: Small bug: --location 2x
Date: Tue, 02 Jan 2001 08:34:00 -0600
>On Wed, 27 Dec 2000, Kevin P Roth wrote:
>> It appears that specifying --location twice in a config-file negates
>> the --location directive.
Daniel Stenberg <daniel_at_haxx.se> 12/30/00 7:29 AM
>Yes. All the boolean-style options to curl work that way. This may not be
>properly documented, but I consider it the only sane way they can work.
>This way, you can set your defaults as you wish in the .curlrc file and then
>toggle them on the command line.
Ahh. That makes sense, now that I think about it. I suppose you probably said this once already and I just forgot... It would probably be good to update the docs a little bit. I don't think the boolean-style options are mentioned at all in `curl --manual`, so perhaps you could add a boolean-style example to the section on the CONFIG FILE, and put a note there to the effect that options which don't take an argument act as toggle-switches. Also, you might throw in a note about what happens if you repeat the other arguments. Some just append additional values (like -d), while I think others just use the last (or is it first) instance of the option (like -U or -w).
>Do you or anyone else have another solution or reasoning how to and why we
>should change this?
My only concern is this: if I see "--location" anywhere, my first assumption is that location hints WILL be followed. It doesn't quite seem natural (to me) to think of this as a toggle switch, with a default of off. If I had --location hidden in a standard config file (eg .curlrc) and accidentally added it to the command line also (forgetting it was in the config file, which is what happened when I ran across this issue) I could scratch my head for quite a while wondering why --location was being "ignored".
I have two suggestions for handling this issue differently, either of which would make this easier (for me).
1) Make the --verbose option display something when any boolean-style option gets toggled. So if --location were in two places, the info from --verbose might look like:
* --location enabled <in config file>
* --location disabled <on command line>
* Connected to www.curl.com
> HEAD /default.htm HTTP/1.0
etc...
and I would have a real good idea what happened.
2) Change the syntax so "--location" always enables the option (no matter how many times you use it) and something like "--no-location" (or perhaps "--location-off") always disables the option.
Thanks for answering my question, and for all your hard work on Curl!
--Kevin
Received on 2001-01-02