Revert "Imported Upstream version 7.44.0"
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_HEADERFUNCTION.html
index 182c1ae..8d112ce 100644 (file)
@@ -4,20 +4,15 @@
 <title>CURLOPT_HEADERFUNCTION man page</title>
 <meta name="generator" content="roffit">
 <STYLE type="text/css">
-pre {
-  overflow: auto;
-  margin: 0;
-}
-
-P.level0, pre.level0 {
+P.level0 {
  padding-left: 2em;
 }
 
-P.level1, pre.level1 {
+P.level1 {
  padding-left: 4em;
 }
 
-P.level2, pre.level2 {
+P.level2 {
  padding-left: 6em;
 }
 
@@ -52,11 +47,11 @@ p.roffit {
 
 <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
 <p class="level0">CURLOPT_HEADERFUNCTION - callback that receives header data <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
-<p class="level0">&#35;include &lt;curl/curl.h&gt; 
+<p class="level0">#include &lt;curl/curl.h&gt; 
 <p class="level0">size_t header_callback(char *buffer, &nbsp;                      size_t size, &nbsp;                      size_t nitems, &nbsp;                      void *userdata); 
 <p class="level0">CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADERFUNCTION, header_callback); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
 <p class="level0">Pass a pointer to your callback function, which should match the prototype shown above. 
-<p class="level0">This function gets called by libcurl as soon as it has received header data. The header callback will be called once for each header and only complete header lines are passed on to the callback. Parsing headers is very easy using this. The size of the data pointed to by <span Class="emphasis">buffer</span> is <span Class="emphasis">size</span> multiplied with <span Class="emphasis">nmemb</span>. Do not assume that the header line is zero terminated! The pointer named <span Class="emphasis">userdata</span> is the one you set with the <a Class="emphasis" href="./CURLOPT_HEADERDATA.html">CURLOPT_HEADERDATA</a> option. This callback function must return the number of bytes actually taken care of. If that amount differs from the amount passed in to your function, it'll signal an error to the library. This will cause the transfer to get aborted and the libcurl function in progress will return <span Class="emphasis">CURLE_WRITE_ERROR</span>. 
+<p class="level0">This function gets called by libcurl as soon as it has received header data. The header callback will be called once for each header and only complete header lines are passed on to the callback. Parsing headers is very easy using this. The size of the data pointed to by <span Class="emphasis">ptr</span> is <span Class="emphasis">size</span> multiplied with <span Class="emphasis">nmemb</span>. Do not assume that the header line is zero terminated! The pointer named <span Class="emphasis">userdata</span> is the one you set with the <a Class="emphasis" href="./CURLOPT_HEADERDATA.html">CURLOPT_HEADERDATA</a> option. This callback function must return the number of bytes actually taken care of. If that amount differs from the amount passed in to your function, it'll signal an error to the library. This will cause the transfer to get aborted and the libcurl function in progress will return <span Class="emphasis">CURL_WRITE_ERROR</span>. 
 <p class="level0">A complete HTTP header that is passed to this function can be up to <span Class="emphasis">CURL_MAX_HTTP_HEADER</span> (100K) bytes. 
 <p class="level0">If this option is not set, or if it is set to NULL, but <a Class="emphasis" href="./CURLOPT_HEADERDATA.html">CURLOPT_HEADERDATA</a> is set to anything but NULL, the function used to accept response data will be used instead. That is, it will be the function specified with <a Class="emphasis" href="./CURLOPT_WRITEFUNCTION.html">CURLOPT_WRITEFUNCTION</a>, or if it is not specified or NULL - the default, stream-writing function. 
 <p class="level0">It's important to note that the callback will be invoked for the headers of all responses received after initiating a request and not just the final response. This includes all responses which occur during authentication negotiation. If you need to operate on only the headers from the final response, you will need to collect headers in the callback yourself and use HTTP status lines, for example, to delimit response boundaries. 
@@ -64,26 +59,7 @@ p.roffit {
 <p class="level0">For non-HTTP protocols like FTP, POP3, IMAP and SMTP this function will get called with the server responses to the commands that libcurl sends. <a name="DEFAULT"></a><h2 class="nroffsh">DEFAULT</h2>
 <p class="level0">Nothing. <a name="PROTOCOLS"></a><h2 class="nroffsh">PROTOCOLS</h2>
 <p class="level0">Used for all protocols with headers or meta-data concept: HTTP, FTP, POP3, IMAP, SMTP and more. <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2>
-<p class="level0"><pre class="level0">
-static size_t header_callback(char *buffer, size_t size,
-&nbsp;                             size_t nitems, void *userdata)
-{
-&nbsp; /* received header is nitems * size long in 'buffer' NOT ZERO TERMINATED */
-&nbsp; /* 'userdata' is set with CURLOPT_WRITEDATA */
-&nbsp; return nitems * size;
-}
-&nbsp;
-CURL *curl = curl_easy_init();
-if(curl) {
-&nbsp; curl_easy_setopt(curl, CURLOPT_URL, "<a href="http://example.com">http://example.com</a>");
-&nbsp;
-&nbsp; curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
-&nbsp;
-&nbsp; curl_easy_perform(curl);
-}
-</pre>
-
-<p class="level0"><a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
+<p class="level0">TODO <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
 <p class="level0">Always <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
 <p class="level0">Returns CURLE_OK <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
 <p class="level0"><a Class="manpage" href="./CURLOPT_HEADERDATA.html">CURLOPT_HEADERDATA</a>, <a Class="manpage" href="./CURLOPT_WRITEFUNCTION.html">CURLOPT_WRITEFUNCTION</a>, <span Class="manpage"> </span> <p class="roffit">