From 3db584a3ea749d92b516914f015bd371879ef67c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 28 Aug 2019 15:09:37 +0200 Subject: [PATCH] curl/Easy: add SetReadFunction() --- src/lib/curl/Easy.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/curl/Easy.hxx b/src/lib/curl/Easy.hxx index 67ce8ce33..479f8f530 100644 --- a/src/lib/curl/Easy.hxx +++ b/src/lib/curl/Easy.hxx @@ -119,6 +119,10 @@ public: SetOption(CURLOPT_USERPWD, userpwd); } + void SetUpload(bool value=true) { + SetOption(CURLOPT_UPLOAD, (long)value); + } + void SetNoProgress(bool value=true) { SetOption(CURLOPT_NOPROGRESS, (long)value); } @@ -154,6 +158,13 @@ public: SetOption(CURLOPT_WRITEDATA, userdata); } + void SetReadFunction(size_t (*function)(char *ptr, size_t size, + size_t nmemb, void *userdata), + void *userdata) { + SetOption(CURLOPT_READFUNCTION, function); + SetOption(CURLOPT_READDATA, userdata); + } + void SetNoBody(bool value=true) { SetOption(CURLOPT_NOBODY, (long)value); }