Imported Upstream version 7.44.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_HTTPHEADER.html
index 308887a..3cbb716 100644 (file)
@@ -4,15 +4,20 @@
 <title>CURLOPT_HTTPHEADER man page</title>
 <meta name="generator" content="roffit">
 <STYLE type="text/css">
-P.level0 {
+pre {
+  overflow: auto;
+  margin: 0;
+}
+
+P.level0, pre.level0 {
  padding-left: 2em;
 }
 
-P.level1 {
+P.level1, pre.level1 {
  padding-left: 4em;
 }
 
-P.level2 {
+P.level2, pre.level2 {
  padding-left: 6em;
 }
 
@@ -47,7 +52,7 @@ p.roffit {
 
 <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
 <p class="level0">CURLOPT_HTTPHEADER - set custom HTTP headers <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
-<p class="level0">#include &lt;curl/curl.h&gt; 
+<p class="level0">&#35;include &lt;curl/curl.h&gt; 
 <p class="level0">CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPHEADER, struct curl_slist *headers); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
 <p class="level0">Pass a pointer to a linked list of HTTP headers to pass to the server and/or proxy in your HTTP request. The same list can be used for both host and proxy requests! 
 <p class="level0">The linked list should be a fully valid list of <span Class="bold">struct curl_slist</span> structs properly filled in. Use <span Class="emphasis">curl_slist_append(3)</span> to create the list and <span Class="emphasis">curl_slist_free_all(3)</span> to clean up an entire list. If you add a header that is otherwise generated and used by libcurl internally, your added one will be used instead. If you add a header with no content as in 'Accept:' (no data on the right side of the colon), the internally used header will get disabled. With this option you can add new headers, replace internal headers and remove internal headers. To add a header with no content (nothing to the right side of the colon), use the form 'MyHeader;' (note the ending semicolon). 
@@ -55,13 +60,35 @@ p.roffit {
 <p class="level0">The first line in a request (containing the method, usually a GET or POST) is not a header and cannot be replaced using this option. Only the lines following the request-line are headers. Adding this method line in this list of headers will only cause your request to send an invalid header. Use <a Class="emphasis" href="./CURLOPT_CUSTOMREQUEST.html">CURLOPT_CUSTOMREQUEST</a> to change the method. 
 <p class="level0">When this option is passed to <span Class="emphasis">curl_easy_setopt(3)</span>, libcurl will not copy the entire list so you <span Class="bold">must</span> keep it around until you no longer use this <span Class="emphasis">handle</span> for a transfer before you call <span Class="emphasis">curl_slist_free_all(3)</span> on the list. 
 <p class="level0">Pass a NULL to this option to reset back to no custom headers. 
-<p class="level0">The most commonly replaced headers have "shortcuts" in the options <a Class="emphasis" href="./CURLOPT_COOKIE.html">CURLOPT_COOKIE</a>, <a Class="emphasis" href="./CURLOPT_USERAGENT.html">CURLOPT_USERAGENT</a> and <a Class="emphasis" href="./CURLOPT_REFERER.html">CURLOPT_REFERER</a>. 
-<p class="level0">There's an alternative option that sets or replaces headers only for requests that are sent with CONNECT to a proxy: <a Class="emphasis" href="./CURLOPT_PROXYHEADER.html">CURLOPT_PROXYHEADER</a>. Use <a Class="emphasis" href="./CURLOPT_HEADEROPT.html">CURLOPT_HEADEROPT</a> to control the behavior. <a name="DEFAULT"></a><h2 class="nroffsh">DEFAULT</h2>
+<p class="level0">The most commonly replaced headers have "shortcuts" in the options <a Class="emphasis" href="./CURLOPT_COOKIE.html">CURLOPT_COOKIE</a>, <a Class="emphasis" href="./CURLOPT_USERAGENT.html">CURLOPT_USERAGENT</a> and <a Class="emphasis" href="./CURLOPT_REFERER.html">CURLOPT_REFERER</a>. We recommend using those. 
+<p class="level0">There's an alternative option that sets or replaces headers only for requests that are sent with CONNECT to a proxy: <a Class="emphasis" href="./CURLOPT_PROXYHEADER.html">CURLOPT_PROXYHEADER</a>. Use <a Class="emphasis" href="./CURLOPT_HEADEROPT.html">CURLOPT_HEADEROPT</a> to control the behavior. <a name="SECURITY"></a><h2 class="nroffsh">SECURITY CONCERNS</h2>
+<p class="level0">By default, this option makes libcurl send the given headers in all HTTP requests done by this handle. You should therefore use this option with caution if you for example connect to the remote site using a proxy and a CONNECT request, you should to consider if that proxy is supposed to also get the headers. They may be private or otherwise sensitive to leak. 
+<p class="level0">Use <a Class="emphasis" href="./CURLOPT_HEADEROPT.html">CURLOPT_HEADEROPT</a> to make the headers only get sent to where you intend them to get sent. <a name="DEFAULT"></a><h2 class="nroffsh">DEFAULT</h2>
 <p class="level0">NULL <a name="PROTOCOLS"></a><h2 class="nroffsh">PROTOCOLS</h2>
 <p class="level0">HTTP <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2>
-<p class="level0">TODO <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
+<p class="level0"><pre class="level0">
+CURL *curl = curl_easy_init();
+&nbsp;
+struct curl_slist *list = NULL;
+&nbsp;
+if(curl) {
+&nbsp; curl_easy_setopt(curl, CURLOPT_URL, "<a href="http://example.com">http://example.com</a>");
+&nbsp;
+&nbsp; list = curl_slist_append(list, "Shoesize: 10");
+&nbsp; list = curl_slist_append(list, "Accept:");
+&nbsp;
+&nbsp; curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
+&nbsp;
+&nbsp; curl_easy_perform(curl);
+&nbsp;
+&nbsp; curl_slist_free_all(list); /* free the list again */
+}
+</pre>
+
+<p class="level0">
+<p class="level0"><a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
 <p class="level0">As long as HTTP is enabled <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
 <p class="level0">Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
-<p class="level0"><a Class="manpage" href="./CURLOPT_CUSTOMREQUEST.html">CURLOPT_CUSTOMREQUEST</a>, <a Class="manpage" href="./CURLOPT_HEADEROPT.html">CURLOPT_HEADEROPT</a>, <span Class="manpage"> </span> <a Class="manpage" href="./CURLOPT_PROXYHEADER.html">CURLOPT_PROXYHEADER</a>, <p class="roffit">
+<p class="level0"><a Class="manpage" href="./CURLOPT_CUSTOMREQUEST.html">CURLOPT_CUSTOMREQUEST</a>, <a Class="manpage" href="./CURLOPT_HEADEROPT.html">CURLOPT_HEADEROPT</a>, <span Class="manpage"> </span> <a Class="manpage" href="./CURLOPT_PROXYHEADER.html">CURLOPT_PROXYHEADER</a>, <a Class="manpage" href="./CURLOPT_HEADER.html">CURLOPT_HEADER</a>, <p class="roffit">
  This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
 </body></html>