--- C:/Users/andyc/Documents/My Stuff/WorkshopWeb/wp-includes/class-http-origional.php	Tue Mar 13 10:14:27 2012
+++ C:/Users/andyc/Documents/My Stuff/WorkshopWeb/wp-includes/class-http.php	Wed Mar 14 10:23:06 2012
@@ -1042,7 +1042,6 @@
 		curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false );
 		curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
 		curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
-		curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
 
 		switch ( $r['method'] ) {
 			case 'HEAD':
@@ -1074,9 +1073,14 @@
 			curl_setopt( $handle, CURLOPT_FILE, $stream_handle );
 		}
 
-		// The option doesn't work with safe mode or when open_basedir is set.
+		// The curl follow location option doesn't work with safe mode or when open_basedir is set.
 		if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 0 !== $r['_redirection'] )
-			curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
+            $autoredirect = true;
+        
+        if ($autoredirect)   {
+            curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
+            curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
+        }
 
 		if ( !empty( $r['headers'] ) ) {
 			// cURL expects full header strings in each element
@@ -1110,10 +1114,11 @@
 		if ( strlen($theResponse) > 0 && ! is_bool( $theResponse ) ) // is_bool: when using $args['stream'], curl_exec will return (bool)true
 			$theBody = $theResponse;
 
-		// If no response, and It's not a HEAD request with valid headers returned
-		if ( 0 == strlen($theResponse) && ('HEAD' != $args['method'] || empty($this->headers)) ) {
-			if ( $curl_error = curl_error($handle) )
-				return new WP_Error('http_request_failed', $curl_error);
+        if ( $curl_error = curl_error($handle) )
+			return new WP_Error('http_request_failed', $curl_error);
+
+		// Handle too many redirects with Curl auto redirect
+		if ($autoredirect && 0 == strlen($theResponse) && ('HEAD' != $args['method'] || empty($this->headers)) ) {
 			if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )
    	            return new WP_Error('http_request_failed', __('Too many redirects.'));
 		}
@@ -1130,7 +1135,7 @@
 			fclose( $stream_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' ) ) && 0 !== $r['_redirection'] ) {
+		if ( ! empty( $theHeaders['headers']['location'] ) && !$autoredirect ) {
 			if ( $r['redirection']-- > 0 ) {
 				return $this->request( $theHeaders['headers']['location'], $r );
 			} else {
