2
0

header.d 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 will be used instead of the internal one.
  25. This allows you to make even trickier stuff than curl would normally do. You
  26. should not replace internally set headers without knowing perfectly well what
  27. you are doing. Remove an internal header by giving a replacement without
  28. content on the right side of the colon, as in: -H "Host:". If you send the
  29. custom header with no-value then its header must be terminated with a
  30. semicolon, such as \-H "X-Custom-Header;" to send "X-Custom-Header:".
  31. curl will make 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 will only mess things
  34. up for 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 @- will make curl read the header file
  37. from 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, will make curl send the data using chunked encoding.
  45. **WARNING**: headers set with this option will be set in all HTTP requests
  46. - even after redirects are followed, like when told with --location. This can
  47. lead to the header being sent to other hosts than the original host, so
  48. sensitive headers should be used with caution combined with following
  49. redirects.