### Eclipse Workspace Patch 1.0
#P wordpress-trunk
Index: wp-includes/class-http.php
===================================================================
--- wp-includes/class-http.php	(revision 17521)
+++ wp-includes/class-http.php	(working copy)
@@ -981,7 +981,8 @@
 	function request($url, $args = array()) {
 		$defaults = array(
 			'method' => 'GET', 'timeout' => 5,
-			'redirection' => 5, 'httpversion' => '1.0',
+			'redirection' => 5, 'followlocation' => true,
+			'httpversion' => '1.0',
 			'blocking' => true,
 			'headers' => array(), 'body' => null, 'cookies' => array()
 		);
@@ -1027,6 +1028,7 @@
 				'method' => strtoupper($r['method']),
 				'user_agent' => $r['user-agent'],
 				'max_redirects' => $r['redirection'] + 1, // See #11557
+				'follow_location' => (int) $r['followlocation'],
 				'protocol_version' => (float) $r['httpversion'],
 				'header' => $strHeaders,
 				'ignore_errors' => true, // Return non-200 requests.
@@ -1304,8 +1306,8 @@
 	function request($url, $args = array()) {
 		$defaults = array(
 			'method' => 'GET', 'timeout' => 5,
-			'redirection' => 5, 'httpversion' => '1.0',
-			'blocking' => true,
+			'redirection' => 5, 'followlocation' => !(ini_get('safe_mode') || ini_get('open_basedir')), 
+			'httpversion' => '1.0', 'blocking' => true,
 			'headers' => array(), 'body' => null, 'cookies' => array()
 		);
 
@@ -1367,6 +1369,7 @@
 		curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
 		curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
 		curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
+		curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, $r['followlocation'] );
 
 		switch ( $r['method'] ) {
 			case 'HEAD':
@@ -1448,7 +1451,7 @@
 		curl_close( $handle );
 
 		// See #11305 - 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['followlocation'] && !empty($theHeaders['headers']['location']) && (ini_get('safe_mode') || ini_get('open_basedir')) ) {
 			if ( $r['redirection']-- > 0 ) {
 				return $this->request($theHeaders['headers']['location'], $r);
 			} else {
