Annotation of embedaddon/curl/docs/libcurl/opts/CURLOPT_HEADER.3, revision 1.1
1.1 ! misho 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.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_HEADER 3 "October 03, 2018" "libcurl 7.70.0" "curl_easy_setopt options"
! 24:
! 25: .SH NAME
! 26: CURLOPT_HEADER \- pass headers to the data stream
! 27: .SH SYNOPSIS
! 28: #include <curl/curl.h>
! 29:
! 30: CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADER, long onoff);
! 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:
! 37: When asking to get the headers passed to the same callback as the body, it is
! 38: not possible to accurately separate them again without detailed knowledge
! 39: about the protocol in use.
! 40:
! 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:
! 46: It is often better to use \fICURLOPT_HEADERFUNCTION(3)\fP to get the header
! 47: data separately.
! 48:
! 49: While named confusingly similar, \fICURLOPT_HTTPHEADER(3)\fP is used to set
! 50: custom HTTP headers!
! 51: .SH DEFAULT
! 52: 0
! 53: .SH PROTOCOLS
! 54: Most
! 55: .SH EXAMPLE
! 56: .nf
! 57: CURL *curl = curl_easy_init();
! 58: if(curl) {
! 59: curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
! 60:
! 61: curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
! 62:
! 63: curl_easy_perform(curl);
! 64: }
! 65: .fi
! 66: .SH RETURN VALUE
! 67: Returns CURLE_OK.
! 68: .SH "SEE ALSO"
! 69: .BR CURLOPT_HEADERFUNCTION "(3), "
! 70: .BR CURLOPT_HTTPHEADER "(3), "
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>