diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2022-11-08 18:49:21 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2022-11-10 03:13:58 -0500 |
commit | 6d7511540667e1ddead33c14a40def306e0a50c4 (patch) | |
tree | d0426dde8810e92df8b2bffd5d714ca1687b6cf4 /include | |
parent | 988c1c12f51d4126702288d3c4ec7e5a08030321 (diff) | |
download | curl-6d7511540667e1ddead33c14a40def306e0a50c4.tar.gz |
lib: add CURL_WRITEFUNC_ERROR to signal write callback error
Prior to this change if the user wanted to signal an error from their
write callbacks they would have to use logic to return a value different
from the number of bytes (nmemb) passed to the callback. Also, the
inclination of some users has been to just return 0 to signal error,
which is incorrect as that may be the number of bytes passed to the
callback.
To remedy this the user can now return CURL_WRITEFUNC_ERROR instead.
Ref: https://github.com/curl/curl/issues/9873
Closes https://github.com/curl/curl/pull/9874
Diffstat (limited to 'include')
-rw-r--r-- | include/curl/curl.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h index 8582d1c17..6e569ab75 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -256,6 +256,10 @@ typedef int (*curl_xferinfo_callback)(void *clientp, will signal libcurl to pause receiving on the current transfer. */ #define CURL_WRITEFUNC_PAUSE 0x10000001 +/* This is a magic return code for the write callback that, when returned, + will signal an error from the callback. */ +#define CURL_WRITEFUNC_ERROR 0xFFFFFFFF + typedef size_t (*curl_write_callback)(char *buffer, size_t size, size_t nitems, |