CURLOPT_HEADER.3 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, 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 https://curl.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_HEADER 3 "16 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_HEADER \- pass headers to the data stream
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADER, long onoff);
  30. .fi
  31. .SH DESCRIPTION
  32. Pass the long value \fIonoff\fP set to 1 to ask libcurl to include the headers
  33. in the write callback (\fICURLOPT_WRITEFUNCTION(3)\fP). This option is
  34. relevant for protocols that actually have headers or other meta-data (like
  35. HTTP and FTP).
  36. When asking to get the headers passed to the same callback as the body, it is
  37. not possible to accurately separate them again without detailed knowledge
  38. about the protocol in use.
  39. Further: the \fICURLOPT_WRITEFUNCTION(3)\fP callback is limited to only ever
  40. get a maximum of \fICURL_MAX_WRITE_SIZE\fP bytes passed to it (16KB), while a
  41. header can be longer and the \fICURLOPT_HEADERFUNCTION(3)\fP supports getting
  42. called with headers up to \fICURL_MAX_HTTP_HEADER\fP bytes big (100KB).
  43. It is often better to use \fICURLOPT_HEADERFUNCTION(3)\fP to get the header
  44. data separately.
  45. While named confusingly similar, \fICURLOPT_HTTPHEADER(3)\fP is used to set
  46. custom HTTP headers!
  47. .SH DEFAULT
  48. 0
  49. .SH PROTOCOLS
  50. Most
  51. .SH EXAMPLE
  52. .nf
  53. CURL *curl = curl_easy_init();
  54. if(curl) {
  55. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  56. curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
  57. curl_easy_perform(curl);
  58. }
  59. .fi
  60. .SH AVAILABILITY
  61. Provided in all libcurl versions.
  62. .SH RETURN VALUE
  63. Returns CURLE_OK.
  64. .SH "SEE ALSO"
  65. .BR CURLOPT_HEADERFUNCTION "(3), "
  66. .BR CURLOPT_HTTPHEADER "(3), "