Allow cURL to follow redirects when running under safe_mode or open_basedir. See #11305

git-svn-id: http://svn.automattic.com/wordpress/trunk@12747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-01-17 08:15:52 +00:00
parent 8c109d738b
commit b34906e9ec
1 changed files with 9 additions and 0 deletions

View File

@ -1397,6 +1397,15 @@ class WP_Http_Curl {
if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
$theBody = WP_Http_Encoding::decompress( $theBody );
// See #11605 - When running under safe mode, redirection is disabled above. Handle it manually.
if ( !empty($theHeaders['headers']['location']) && (ini_get('safe_mode') || ini_get('open_basedir')) ) {
if ( $r['redirection']-- > 0 ) {
return $this->request($theHeaders['headers']['location'], $r);
} else {
return new WP_Error('http_request_failed', __('Too many redirects.'));
}
}
return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response, 'cookies' => $theHeaders['cookies']);
}