From 57e31fe5a7315507ccda78a1f38f79b1c355b054 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sun, 14 Aug 2022 16:38:58 +0000 Subject: [PATCH] Handle valid HTTP responses with no response body. --- classes/urlhelper.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/classes/urlhelper.php b/classes/urlhelper.php index bb51f5d06..f8fdd7de9 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -462,7 +462,11 @@ class UrlHelper { } if (!$contents) { - self::$fetch_last_error = curl_errno($ch) . " " . curl_error($ch); + if (curl_errno($ch) === 0) { + self::$fetch_last_error = 'Successful response, but no content was received.'; + } else { + self::$fetch_last_error = curl_errno($ch) . " " . curl_error($ch); + } curl_close($ch); return false; } @@ -578,6 +582,11 @@ class UrlHelper { return false; } + if (!$data) { + self::$fetch_last_error = 'Successful response, but no content was received.'; + return false; + } + $is_gzipped = RSSUtils::is_gzipped($data); if ($is_gzipped && $data) {