docs/cmdline: change to .md for cmdline docs
- switch all invidual files documenting command line options into .md,
as the documentation is now markdown-looking.
- made the parser treat 4-space indents as quotes
- switch to building the curl.1 manpage using the "mainpage.idx" file,
which lists the files to include to generate it, instead of using the
previous page-footer/headers. Also, those files are now also .md
ones, using the same format. I gave them underscore prefixes to make
them sort separately:
_NAME.md, _SYNOPSIS.md, _DESCRIPTION.md, _URL.md, _GLOBBING.md,
_VARIABLES.md, _OUTPUT.md, _PROTOCOLS.md, _PROGRESS.md, _VERSION.md,
_OPTIONS.md, _FILES.md, _ENVIRONMENT.md, _PROXYPREFIX.md,
_EXITCODES.md, _BUGS.md, _AUTHORS.md, _WWW.md, _SEEALSO.md
- updated test cases accordingly
Closes #12751
2024-01-21 06:18:43 +08:00
|
|
|
---
|
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
|
2021-09-28 17:50:07 +08:00
|
|
|
Added: 5.0
|
2022-10-18 16:39:43 +08:00
|
|
|
Multi: append
|
docs/cmdline: change to .md for cmdline docs
- switch all invidual files documenting command line options into .md,
as the documentation is now markdown-looking.
- made the parser treat 4-space indents as quotes
- switch to building the curl.1 manpage using the "mainpage.idx" file,
which lists the files to include to generate it, instead of using the
previous page-footer/headers. Also, those files are now also .md
ones, using the same format. I gave them underscore prefixes to make
them sort separately:
_NAME.md, _SYNOPSIS.md, _DESCRIPTION.md, _URL.md, _GLOBBING.md,
_VARIABLES.md, _OUTPUT.md, _PROTOCOLS.md, _PROGRESS.md, _VERSION.md,
_OPTIONS.md, _FILES.md, _ENVIRONMENT.md, _PROXYPREFIX.md,
_EXITCODES.md, _BUGS.md, _AUTHORS.md, _WWW.md, _SEEALSO.md
- updated test cases accordingly
Closes #12751
2024-01-21 06:18:43 +08:00
|
|
|
See-also:
|
|
|
|
- user-agent
|
|
|
|
- referer
|
|
|
|
Example:
|
|
|
|
- -H "X-First-Name: Joe" $URL
|
|
|
|
- -H "User-Agent: yes-please/2000" $URL
|
|
|
|
- -H "Host:" $URL
|
|
|
|
- -H @headers.txt $URL
|
2016-11-16 06:44:58 +08:00
|
|
|
---
|
docs/cmdline: change to .md for cmdline docs
- switch all invidual files documenting command line options into .md,
as the documentation is now markdown-looking.
- made the parser treat 4-space indents as quotes
- switch to building the curl.1 manpage using the "mainpage.idx" file,
which lists the files to include to generate it, instead of using the
previous page-footer/headers. Also, those files are now also .md
ones, using the same format. I gave them underscore prefixes to make
them sort separately:
_NAME.md, _SYNOPSIS.md, _DESCRIPTION.md, _URL.md, _GLOBBING.md,
_VARIABLES.md, _OUTPUT.md, _PROTOCOLS.md, _PROGRESS.md, _VERSION.md,
_OPTIONS.md, _FILES.md, _ENVIRONMENT.md, _PROXYPREFIX.md,
_EXITCODES.md, _BUGS.md, _AUTHORS.md, _WWW.md, _SEEALSO.md
- updated test cases accordingly
Closes #12751
2024-01-21 06:18:43 +08:00
|
|
|
|
|
|
|
# `--header`
|
|
|
|
|
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
|
2023-09-08 20:32:29 +08:00
|
|
|
use, your externally set header is 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
|
2024-02-06 18:20:30 +08:00
|
|
|
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:`.
|
2023-09-08 20:32:29 +08:00
|
|
|
|
|
|
|
curl makes 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
|
2023-09-08 20:32:29 +08:00
|
|
|
content: do not add newlines or carriage returns, they only mess things up for
|
2023-11-02 20:05:10 +08:00
|
|
|
you. curl passes on the verbatim string you give it without any filter or
|
|
|
|
other safe guards. That includes white space and control characters.
|
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
|
2023-09-08 20:32:29 +08:00
|
|
|
for each line in the input file. Using @- makes curl read the header file from
|
2024-06-24 22:25:40 +08:00
|
|
|
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
|
2024-02-06 18:20:30 +08:00
|
|
|
several MIME mail headers: these are `From:`, `To:`, `Date:` and `Subject:`
|
2022-09-29 00:12:15 +08:00
|
|
|
among others and should be added with this option.
|
|
|
|
|
2024-06-24 19:57:02 +08:00
|
|
|
You need --proxy-header to send custom headers intended for an HTTP 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
|
2023-09-08 20:32:29 +08:00
|
|
|
with a request body, makes curl send the data using chunked encoding.
|
2016-11-16 06:44:58 +08:00
|
|
|
|
2023-09-08 20:32:29 +08:00
|
|
|
**WARNING**: headers set with this option are 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.
|