MultiHttpClient: Also fallover to non-curl if curl_multi* is blocked
authorJames D. Forrester <jforrester@wikimedia.org>
Wed, 15 Apr 2020 19:34:51 +0000 (12:34 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Mon, 27 Apr 2020 22:27:44 +0000 (15:27 -0700)
Requested by a user at https://www.mediawiki.org/wiki/Topic:Vkk1ahk3eggd9747 for
whom their hoster provides curl but with multi-threaded functions removed for
some reason.

Change-Id: Id3877c600ae02feffb67f74a815430f8e679230a
(cherry picked from commit 1c241419914d1203ea90eeea6a41d76f4a2ecbec)

RELEASE-NOTES-1.34
includes/libs/http/MultiHttpClient.php

index 3b5def5..d035653 100644 (file)
@@ -5,6 +5,7 @@
 THIS IS NOT A RELEASE YET
 
 === Changes since MediaWiki 1.34.1 ===
+* The MultiHttpClient code will fallover to non-curl if curl_multi* is blocked.
 
 == MediaWiki 1.34.1 ==
 
index b0c8a8b..85959d6 100644 (file)
@@ -176,7 +176,9 @@ class MultiHttpClient implements LoggerAwareInterface {
         * @return bool true if curl is available, false otherwise.
         */
        protected function isCurlEnabled() {
-               return extension_loaded( 'curl' );
+               // Explicitly test if curl_multi* is blocked, as some users' hosts provide
+               // them with a modified curl with the multi-threaded parts removed(!)
+               return extension_loaded( 'curl' ) && function_exists( 'curl_multi_init' );
        }
 
        /**