CURLOPT_HEADER.3 2.6 KB

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