curl/Easy: add SetReadFunction()

This commit is contained in:
Max Kellermann 2019-08-28 15:09:37 +02:00 committed by Max Kellermann
parent 409002b1c3
commit 3db584a3ea

View File

@ -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);
}