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