header.d 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  2. SPDX-License-Identifier: curl
  3. Long: header
  4. Short: H
  5. Arg: <header/@file>
  6. Help: Pass custom header(s) to server
  7. Protocols: HTTP IMAP SMTP
  8. Category: http imap smtp
  9. See-also: user-agent referer
  10. Example: -H "X-First-Name: Joe" $URL
  11. Example: -H "User-Agent: yes-please/2000" $URL
  12. Example: -H "Host:" $URL
  13. Example: -H @headers.txt $URL
  14. Added: 5.0
  15. Multi: append
  16. ---
  17. Extra header to include in information sent. When used within an HTTP request,
  18. it is added to the regular request headers.
  19. For an IMAP or SMTP MIME uploaded mail built with --form options, it is
  20. prepended to the resulting MIME document, effectively including it at the mail
  21. global level. It does not affect raw uploaded mails (Added in 7.56.0).
  22. You may specify any number of extra headers. Note that if you should add a
  23. custom header that has the same name as one of the internal ones curl would
  24. use, your externally set header is used instead of the internal one. This
  25. allows you to make even trickier stuff than curl would normally do. You should
  26. not replace internally set headers without knowing perfectly well what you are
  27. doing. Remove an internal header by giving a replacement without content on
  28. the right side of the colon, as in: -H "Host:". If you send the custom header
  29. with no-value then its header must be terminated with a semicolon, such as \-H
  30. "X-Custom-Header;" to send "X-Custom-Header:".
  31. curl makes sure that each header you add/replace is sent with the proper
  32. end-of-line marker, you should thus **not** add that as a part of the header
  33. content: do not add newlines or carriage returns, they only mess things up for
  34. you.
  35. This option can take an argument in @filename style, which then adds a header
  36. for each line in the input file. Using @- makes curl read the header file from
  37. stdin. Added in 7.55.0.
  38. Please note that most anti-spam utilities check the presence and value of
  39. several MIME mail headers: these are "From:", "To:", "Date:" and "Subject:"
  40. among others and should be added with this option.
  41. You need --proxy-header to send custom headers intended for an HTTP
  42. proxy. Added in 7.37.0.
  43. Passing on a "Transfer-Encoding: chunked" header when doing an HTTP request
  44. with a request body, makes curl send the data using chunked encoding.
  45. **WARNING**: headers set with this option are set in all HTTP requests - even
  46. after redirects are followed, like when told with --location. This can lead to
  47. the header being sent to other hosts than the original host, so sensitive
  48. headers should be used with caution combined with following redirects.