curl/Handler: disallow OnData() to throw

This eliminates some complexity from class CurlRequest.
This commit is contained in:
Max Kellermann
2020-12-11 14:13:53 +01:00
committed by Max Kellermann
parent 1e3089ffb7
commit 1f312b2e42
4 changed files with 8 additions and 37 deletions

View File

@@ -31,11 +31,9 @@
#define CURL_REQUEST_HXX
#include "Easy.hxx"
#include "event/DeferEvent.hxx"
#include <map>
#include <string>
#include <exception>
struct StringView;
class CurlGlobal;
@@ -57,18 +55,6 @@ class CurlRequest final {
std::multimap<std::string, std::string> headers;
/**
* An exception caught by DataReceived(), which will be
* forwarded into a "safe" stack frame by
* #postpone_error_event. This works around the
* problem that libcurl crashes if you call
* curl_multi_remove_handle() from within the WRITEFUNCTION
* (i.e. DataReceived()).
*/
std::exception_ptr postponed_error;
DeferEvent postpone_error_event;
/** error message provided by libcurl */
char error_buffer[CURL_ERROR_SIZE];
@@ -167,8 +153,6 @@ private:
void HeaderFunction(StringView s) noexcept;
void OnPostponeError() noexcept;
/** called by curl when new data is available */
static size_t _HeaderFunction(char *ptr, size_t size, size_t nmemb,
void *stream) noexcept;