From d1a8441bb2191badf0aa2060fd8b37a32f1aae9a Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Sat, 21 Dec 2024 14:36:37 +0100 Subject: [PATCH] Allow open(curl(url) to be interrupted --- src/curl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/curl.c b/src/curl.c index 540c6f2..7f0f73f 100644 --- a/src/curl.c +++ b/src/curl.c @@ -224,6 +224,10 @@ static Rboolean rcurl_open(Rconnection con) { while(block_open && req->has_more && !req->has_data) { int numfds; massert(curl_multi_wait(req->manager, NULL, 0, 1000, &numfds)); + if(pending_interrupt()) { + reset(con); //cleanup before jumping + assert_message(CURLE_ABORTED_BY_CALLBACK, ""); + } massert(curl_multi_perform(req->manager, &(req->has_more))); for(int msg = 1; msg > 0;){ CURLMsg *out = curl_multi_info_read(req->manager, &msg);