xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | c: Copyright (C) 1998 - 2022, 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 | Added: 5.0 |
| 14 | Multi: append |
| 15 | --- |
| 16 | Extra header to include in information sent. When used within an HTTP request, |
| 17 | it is added to the regular request headers. |
| 18 | |
| 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 | |
| 23 | You may specify any number of extra headers. Note that if you should add a |
| 24 | custom header that has the same name as one of the internal ones curl would |
| 25 | use, your externally set header will be used instead of the internal one. |
| 26 | This allows you to make even trickier stuff than curl would normally do. You |
| 27 | should not replace internally set headers without knowing perfectly well what |
| 28 | you are doing. Remove an internal header by giving a replacement without |
| 29 | content on the right side of the colon, as in: -H "Host:". If you send the |
| 30 | custom header with no-value then its header must be terminated with a |
| 31 | semicolon, such as \-H "X-Custom-Header;" to send "X-Custom-Header:". |
| 32 | |
| 33 | curl will make sure that each header you add/replace is sent with the proper |
| 34 | end-of-line marker, you should thus **not** add that as a part of the header |
| 35 | content: do not add newlines or carriage returns, they will only mess things |
| 36 | up for you. |
| 37 | |
| 38 | This option can take an argument in @filename style, which then adds a header |
| 39 | for each line in the input file. Using @- will make curl read the header file |
| 40 | from stdin. Added in 7.55.0. |
| 41 | |
| 42 | Please note that most anti-spam utilities check the presence and value of |
| 43 | several MIME mail headers: these are "From:", "To:", "Date:" and "Subject:" |
| 44 | among others and should be added with this option. |
| 45 | |
| 46 | You need --proxy-header to send custom headers intended for an HTTP |
| 47 | proxy. Added in 7.37.0. |
| 48 | |
| 49 | Passing on a "Transfer-Encoding: chunked" header when doing an HTTP request |
| 50 | with 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 |
| 54 | lead to the header being sent to other hosts than the original host, so |
| 55 | sensitive headers should be used with caution combined with following |
| 56 | redirects. |