aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-09-25 18:53:29 +0200
committerYang Tse <yangsita@gmail.com>2011-09-25 19:05:46 +0200
commit119f43360b60c903982104944145d9cd8b7ec054 (patch)
tree7cba5f3f98a946c0dca572eb22a2f48e98c5ee10 /include
parente276802ff84d58aa2484f8292651dad4c50a5407 (diff)
allow write callbacks to indicate OOM to libcurl
Allow (*curl_write_callback) write callbacks to return CURL_WRITEFUNC_OUT_OF_MEMORY to properly indicate libcurl of OOM conditions inside the callback itself.
Diffstat (limited to 'include')
-rw-r--r--include/curl/curl.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h
index ef6bda8f3..4f0182616 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -187,10 +187,15 @@ typedef int (*curl_progress_callback)(void *clientp,
#define CURL_MAX_HTTP_HEADER (100*1024)
#endif
-
/* This is a magic return code for the write callback that, when returned,
will signal libcurl to pause receiving on the current transfer. */
#define CURL_WRITEFUNC_PAUSE 0x10000001
+
+/* If the write callback itself allocates memory dynamically and this fails
+ due to an out of memory condition, returning CURL_WRITEFUNC_OUT_OF_MEMORY
+ is the proper way to tell libcurl of this condition. */
+#define CURL_WRITEFUNC_OUT_OF_MEMORY 0x10000002
+
typedef size_t (*curl_write_callback)(char *buffer,
size_t size,
size_t nitems,