X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FHttpClient.php;h=3148c536058f9e9538ae72670abd21aef5991d1c;hb=5dc8d80defb19ece6aed1a0b1a56dac949573ba2;hp=fa5219fe3ca8f5b6fd3e4c05c3206630229043b0;hpb=639a47e989e0b5b12be546d93f99ec0571f887ee;p=civicrm-core.git diff --git a/CRM/Utils/HttpClient.php b/CRM/Utils/HttpClient.php index fa5219fe3c..3148c53605 100644 --- a/CRM/Utils/HttpClient.php +++ b/CRM/Utils/HttpClient.php @@ -1,9 +1,9 @@ connectionTimeout = $connectionTimeout; } @@ -145,7 +151,9 @@ class CRM_Utils_HttpClient { * Send an HTTP POST for a remote resource * * @param string $remoteFile URL of a .zip file - * @param string $localFile path at which to store the .zip file + * @param $params + * + * @internal param string $localFile path at which to store the .zip file * @return array array(0 => STATUS_OK|STATUS_DL_ERROR, 1 => string) */ public function post($remoteFile, $params) { @@ -192,7 +200,9 @@ class CRM_Utils_HttpClient { curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); curl_setopt($ch, CURLOPT_VERBOSE, 0); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); + if ($this->isRedirectSupported()) { + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); + } if ($this->connectionTimeout !== NULL) { curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectionTimeout); } @@ -203,4 +213,11 @@ class CRM_Utils_HttpClient { return array($ch, $caConfig); } + /** + * @return bool + */ + public function isRedirectSupported() { + return (ini_get('open_basedir') == '') && (ini_get('safe_mode') == 'Off' || ini_get('safe_mode') === FALSE); + } + }