skyzyx
2/26/2011 - 5:37 PM

Patch requestcore.class.php from AWS SDK for PHP 1.2.5 to avoid errors under safe_mode.

Patch requestcore.class.php from AWS SDK for PHP 1.2.5 to avoid errors under safe_mode.

--- cfsdk/lib/requestcore/requestcore.class.php	2011-02-24 13:39:27.000000000 -0800
+++ PHPRequestCore/requestcore.class.php	2011-02-26 09:32:00.000000000 -0800
@@ -515,31 +515,35 @@
 	{
 		$curl_handle = curl_init();
 
 		// Set default options.
 		curl_setopt($curl_handle, CURLOPT_URL, $this->request_url);
 		curl_setopt($curl_handle, CURLOPT_FILETIME, true);
 		curl_setopt($curl_handle, CURLOPT_FRESH_CONNECT, false);
 		curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
 		curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, true);
 		curl_setopt($curl_handle, CURLOPT_CLOSEPOLICY, CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
-		curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
 		curl_setopt($curl_handle, CURLOPT_MAXREDIRS, 5);
 		curl_setopt($curl_handle, CURLOPT_HEADER, true);
 		curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
 		curl_setopt($curl_handle, CURLOPT_TIMEOUT, 5184000);
 		curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 120);
 		curl_setopt($curl_handle, CURLOPT_NOSIGNAL, true);
 		curl_setopt($curl_handle, CURLOPT_REFERER, $this->request_url);
 		curl_setopt($curl_handle, CURLOPT_USERAGENT, $this->useragent);
 		curl_setopt($curl_handle, CURLOPT_READFUNCTION, array($this, 'streaming_read_callback'));
 
+		if (!ini_get('safe_mode'))
+		{
+			curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
+		}
+
 		// Enable a proxy connection if requested.
 		if ($this->proxy)
 		{
 			curl_setopt($curl_handle, CURLOPT_HTTPPROXYTUNNEL, true);
 
 			$host = $this->proxy['host'];
 			$host .= ($this->proxy['port']) ? ':' . $this->proxy['port'] : '';
 			curl_setopt($curl_handle, CURLOPT_PROXY, $host);
 
 			if (isset($this->proxy['user']) && isset($this->proxy['pass']))