diff options
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 b/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 index 5fc0087d6..f5a45a3c6 100644 --- a/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 @@ -38,7 +38,21 @@ This callback function gets called by libcurl as soon as there is data received that needs to be saved. \fIptr\fP points to the delivered data, and the size of that data is \fIsize\fP multiplied with \fInmemb\fP. -The received data will not be zero terminated! +The callback function will be passed as much data as possible in all invokes, +but you must not make any assumptions. It may be one byte, it may be +thousands. The maximum amount of body data that will be passed to the write +callback is defined in the curl.h header file: \fICURL_MAX_WRITE_SIZE\fP (the +usual default is 16K). If \fICURLOPT_HEADER(3)\fP is enabled, which makes +header data get passed to the write callback, you can get up to +\fICURL_MAX_HTTP_HEADER\fP bytes of header data passed into it. This usually +means 100K. + +This function may be called with zero bytes data if the transferred file is +empty. + +The data passed to this function will not be zero terminated! + +Set the \fIuserdata\fP argument with the \fICURLOPT_WRITEDATA(3)\fP option. Your callback should return the number of bytes actually taken care of. If that amount differs from the amount passed to your callback function, it'll @@ -48,23 +62,9 @@ aborted and the libcurl function used will return \fICURLE_WRITE_ERROR\fP. If your callback function returns CURL_WRITEFUNC_PAUSE it will cause this transfer to become paused. See \fIcurl_easy_pause(3)\fP for further details. -This function may be called with zero bytes data if the transferred file is -empty. - Set this option to NULL to get the internal default function used instead of your callback. The internal default function will write the data to the FILE * given with \fICURLOPT_WRITEDATA(3)\fP. - -Set the \fIuserdata\fP argument with the \fICURLOPT_WRITEDATA(3)\fP option. - -The callback function will be passed as much data as possible in all invokes, -but you cannot possibly make any assumptions. It may be one byte, it may be -thousands. The maximum amount of body data that will be passed to the write -callback is defined in the curl.h header file: \fICURL_MAX_WRITE_SIZE\fP (the -usual default is 16K). If you however have \fICURLOPT_HEADER(3)\fP set, which -sends header data to the write callback, you can get up to -\fICURL_MAX_HTTP_HEADER\fP bytes of header data passed into it. This usually -means 100K. .SH DEFAULT libcurl will use 'fwrite' as a callback by default. .SH PROTOCOLS |