mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Added new CURLOPT_HEADERFUNCTION callback for writing headers only
This commit is contained in:
parent
ac510ab6a4
commit
025fa762f6
@ -430,6 +430,10 @@ typedef enum {
|
|||||||
phase. [Only works on unix-style/SIGALRM operating systems] */
|
phase. [Only works on unix-style/SIGALRM operating systems] */
|
||||||
CINIT(CONNECTTIMEOUT, LONG, 78),
|
CINIT(CONNECTTIMEOUT, LONG, 78),
|
||||||
|
|
||||||
|
/* Function that will be called to store headers (instead of fwrite). The
|
||||||
|
* parameters will use fwrite() syntax, make sure to follow them. */
|
||||||
|
CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
|
||||||
|
|
||||||
CURLOPT_LASTENTRY /* the last unusued */
|
CURLOPT_LASTENTRY /* the last unusued */
|
||||||
} CURLoption;
|
} CURLoption;
|
||||||
|
|
||||||
|
@ -236,7 +236,14 @@ CURLcode Curl_client_write(struct UrlData *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((type & CLIENTWRITE_HEADER) && data->writeheader) {
|
if((type & CLIENTWRITE_HEADER) && data->writeheader) {
|
||||||
wrote = data->fwrite(ptr, 1, len, data->writeheader);
|
/*
|
||||||
|
* Write headers to the same callback or to the especially setup
|
||||||
|
* header callback function (added after version 7.7.1).
|
||||||
|
*/
|
||||||
|
curl_write_callback writeit=
|
||||||
|
data->fwrite_header?data->fwrite_header:data->fwrite;
|
||||||
|
|
||||||
|
wrote = writeit(ptr, 1, len, data->writeheader);
|
||||||
if(wrote != len) {
|
if(wrote != len) {
|
||||||
failf (data, "Failed writing header");
|
failf (data, "Failed writing header");
|
||||||
return CURLE_WRITE_ERROR;
|
return CURLE_WRITE_ERROR;
|
||||||
|
@ -485,6 +485,9 @@ struct UrlData {
|
|||||||
/* function that stores the output:*/
|
/* function that stores the output:*/
|
||||||
curl_write_callback fwrite;
|
curl_write_callback fwrite;
|
||||||
|
|
||||||
|
/* optional function that stores the header output:*/
|
||||||
|
curl_write_callback fwrite_header;
|
||||||
|
|
||||||
/* function that reads the input:*/
|
/* function that reads the input:*/
|
||||||
curl_read_callback fread;
|
curl_read_callback fread;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user