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