CURLOPT_HEADER.3 2.6 KB

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