Re:Online curl command line builder
by Tiksi on Thursday April 23, 2015 @09:55AM
(#9426648)
Kinda defeats the purpose of using the tool, but headers in curl are pretty simple:
[ Parent
| on HN ]
-H is for headers; yes, but basic auth is actually the base64-encoded string of user:pass , so if constructing it manually you'd want to do something like curl -H "Authorization: Basic $(echo -n 'user:pass' |base64)" http://whatever .
Curl provides a shortcut for this as --user; e.g. curl --user name:pass http://example.com
Try it yourself with -vvv to see all the headers from both ends. Ref: http://curl.haxx.se/docs/httpscripting.html#Basic_Authentica...
http basic auth protocol: http://en.m.wikipedia.org/wiki/Basic_access_authentication
You can also use curl --negotiate -u : for kerberos (provided curl is built with it and spengo). curl supports quite a few less used auth methods, but OP mentioned custom headers, not basic auth per se, (thats why I used Authentication instead of WWW-Authenticate or Authorization as an example)