From 0b181297defac87a058e063e7164d89c4250bf1b Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Wed, 11 Aug 2021 17:20:14 +0100 Subject: [PATCH] Respect http_timeout core setting for Guzzle HTTP requests --- CRM/Utils/Address/USPS.php | 1 + CRM/Utils/Geocode/Google.php | 2 +- ext/recaptcha/lib/recaptcha/recaptchalib.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Utils/Address/USPS.php b/CRM/Utils/Address/USPS.php index 721b2e70e0..fc53a7a70f 100644 --- a/CRM/Utils/Address/USPS.php +++ b/CRM/Utils/Address/USPS.php @@ -74,6 +74,7 @@ class CRM_Utils_Address_USPS { 'API' => 'Verify', 'XML' => $XMLQuery, ], + 'timeout' => \Civi::settings()->get('http_timeout'), ]); $session = CRM_Core_Session::singleton(); diff --git a/CRM/Utils/Geocode/Google.php b/CRM/Utils/Geocode/Google.php index 6ab1397fea..ad670f6c94 100644 --- a/CRM/Utils/Geocode/Google.php +++ b/CRM/Utils/Geocode/Google.php @@ -106,7 +106,7 @@ class CRM_Utils_Geocode_Google { $query = 'https://' . self::$_server . self::$_uri . $add; $client = new GuzzleHttp\Client(); - $request = $client->request('GET', $query); + $request = $client->request('GET', $query, ['timeout' => \Civi::settings()->get('http_timeout')]); $string = $request->getBody(); libxml_use_internal_errors(TRUE); diff --git a/ext/recaptcha/lib/recaptcha/recaptchalib.php b/ext/recaptcha/lib/recaptcha/recaptchalib.php index fdc506eed1..fa15dc4456 100644 --- a/ext/recaptcha/lib/recaptcha/recaptchalib.php +++ b/ext/recaptcha/lib/recaptcha/recaptchalib.php @@ -67,7 +67,7 @@ function _recaptcha_qsencode ($data) { function _recaptcha_http_post($host, $path, $data) { $client = new Client(); try { - $response = $client->request('POST', $host . '/' . $path, ['query' => $data]); + $response = $client->request('POST', $host . '/' . $path, ['query' => $data, 'timeout' => \Civi::settings()->get('http_timeout')]); } catch (Exception $e) { return ''; -- 2.25.1