cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: A small nudge to fix a frequent -X misuse?

From: Aleksandar Lazic <al-curlusers_at_none.at>
Date: Sun, 30 Aug 2015 00:22:43 +0200

Hi Daniel.

Am 30-08-2015 00:08, schrieb Daniel Stenberg:
> Hey friends!
>
> I see lots and lots of curl suggestions and examples on the internet
> use -X where it isn't needed. Like -XGET for an ordinary URL or using
> -d data -XPOST and so on. Just superfluous uses of -X that annoy me
> (possibly slightly more than I can really motivate).
>
> I wanted to see if anyone has opinions about a patch similar to the
> attached one. It will cause a warning get output if a pointless -X is
> used, to help the user figure this out. I also took the change to warn
> for -XHEAD as that will most likely cause a hanging connection in most
> cases.
>
> Example outputs:
>
> $ curl -XPOST -dmoo localhost
> Warning: Superfluous use of -X. --request, POST is already inferred.
> [operation continues]
>
> $ curl -XGET localhost
> Warning: Superfluous use of -X. --request, GET is already inferred.
> [operation continues]
>
> $ curl -XHEAD -I localhost
> Warning: Superfluous use of -X. --request, HEAD is already inferred.
> [operation continues]
>
> $ curl -XHEAD localhost
> Warning: Setting custom HTTP method to HEAD may not work the way you
> want.
>
> Thoughts?

Full Ack.

BR Aleks
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-08-30