From b042412416cc4ecc71c3f9c13239661a0dd588a6 Mon Sep 17 00:00:00 2001 From: Dag Date: Fri, 5 Aug 2022 11:46:32 +0200 Subject: [PATCH] fix: force HTTP 1.1 in curl requests (#2949) Since curl 7.62.0 the default option is: CURL_HTTP_VERSION_2TLS Before that the default used to be: CURL_HTTP_VERSION_1_1 Fix #2947 --- lib/contents.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/contents.php b/lib/contents.php index 94e45b95..5b39bb66 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -181,6 +181,8 @@ function _http_request(string $url, array $config = []): array curl_setopt($ch, CURLOPT_TIMEOUT, $config['timeout']); curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + // Force HTTP 1.1 because newer versions of libcurl defaults to HTTP/2 + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); if ($config['proxy']) { curl_setopt($ch, CURLOPT_PROXY, $config['proxy']); }