6 ms·
Cool, gimme a field to add a custom header (e.g. "Authorization" is pretty common) and I'll use it!
by euphemize 11y ago
Cool, gimme a field to add a custom header (e.g. "Authorization" is pretty common) and I'll use it!
- Tiksi 11y agoKinda defeats the purpose of using the tool, but headers in curl are pretty simple: curl http://example.com -H 'Authentication: root' -H 'Password: p4ssw0rd'
- seanp2k2 11y ago-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 http://whatever . Curl provides a shortcut for this as --user; e.g. curl --user name:pass http://example.com 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_Authentication http://curl.haxx.se/docs/httpscripting.html#Basic_Authentica... http basic auth protocol: http://en.m.wikipedia.org/wiki/Basic_access_authentication http://en.m.wikipedia.org/wiki/Basic_access_authentication
- Tiksi 11y agoYou 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)
- tuxone 11y agohere you are ;)