From dcf0fcc1be38900078e621004ba30fa581e18425 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 19 May 2019 08:01:08 -0700 Subject: [PATCH] Provide background on why curl multi may be unavailable Co-Authored-By: Will Washburn --- src/FasterImage/FasterImage.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/FasterImage/FasterImage.php b/src/FasterImage/FasterImage.php index 2d2f6f3..15b103f 100644 --- a/src/FasterImage/FasterImage.php +++ b/src/FasterImage/FasterImage.php @@ -68,6 +68,17 @@ class FasterImage */ public function batch(array $urls) { + + /** + * It turns out that even when cURL is installed, the `curl_multi_init() + * function may be disabled on some hosts who are seeking to guard against + * DDoS attacks. + * + * @see https://github.com/ampproject/amp-wp/pull/2183#issuecomment-491506514. + * + * If it is disabled, we will batch these synchronously (with a significant + * performance hit). + */ $has_curl_multi = ( function_exists( 'curl_multi_init' ) &&