Revert "Update to 7.40.1"
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_HTTPHEADER.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at http://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .\"
23 .TH CURLOPT_HTTPHEADER 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
24 .SH NAME
25 CURLOPT_HTTPHEADER \- set custom HTTP headers
26 .SH SYNOPSIS
27 #include <curl/curl.h>
28
29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPHEADER, struct curl_slist *headers);
30 .SH DESCRIPTION
31 Pass a pointer to a linked list of HTTP headers to pass to the server and/or
32 proxy in your HTTP request. The same list can be used for both host and proxy
33 requests!
34
35 The linked list should be a fully valid list of \fBstruct curl_slist\fP
36 structs properly filled in. Use \fIcurl_slist_append(3)\fP to create the list
37 and \fIcurl_slist_free_all(3)\fP to clean up an entire list. If you add a
38 header that is otherwise generated and used by libcurl internally, your added
39 one will be used instead. If you add a header with no content as in 'Accept:'
40 (no data on the right side of the colon), the internally used header will get
41 disabled. With this option you can add new headers, replace internal headers
42 and remove internal headers. To add a header with no content (nothing to the
43 right side of the colon), use the form 'MyHeader;' (note the ending
44 semicolon).
45
46 The headers included in the linked list \fBmust not\fP be CRLF-terminated,
47 because libcurl adds CRLF after each header item. Failure to comply with this
48 will result in strange bugs because the server will most likely ignore part of
49 the headers you specified.
50
51 The first line in a request (containing the method, usually a GET or POST) is
52 not a header and cannot be replaced using this option. Only the lines
53 following the request-line are headers. Adding this method line in this list
54 of headers will only cause your request to send an invalid header. Use
55 \fICURLOPT_CUSTOMREQUEST(3)\fP to change the method.
56
57 Pass a NULL to this option to reset back to no custom headers.
58
59 The most commonly replaced headers have "shortcuts" in the options
60 \fICURLOPT_COOKIE(3)\fP, \fICURLOPT_USERAGENT(3)\fP and
61 \fICURLOPT_REFERER(3)\fP.
62
63 There's an alternative option that sets or replaces headers only for requests
64 that are sent with CONNECT to a proxy: \fICURLOPT_PROXYHEADER(3)\fP. Use
65 \fICURLOPT_HEADEROPT(3)\fP to control the behavior.
66 .SH DEFAULT
67 NULL
68 .SH PROTOCOLS
69 HTTP
70 .SH EXAMPLE
71 TODO
72 .SH AVAILABILITY
73 As long as HTTP is enabled
74 .SH RETURN VALUE
75 Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
76 .SH "SEE ALSO"
77 .BR CURLOPT_CUSTOMREQUEST "(3), " CURLOPT_HEADEROPT "(3), "
78 .BR CURLOPT_PROXYHEADER "(3)"