WP_HTTP: Curl: Correct a typo in [20208] causing failed curl requests not to return a WP_Error under certain situations. Props SergeyBiryukov. Fixes #20219

git-svn-id: http://svn.automattic.com/wordpress/trunk@20370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2012-04-05 11:58:04 +00:00
parent 72c5403630
commit c5b25fd6d0
1 changed files with 5 additions and 5 deletions

View File

@ -1110,11 +1110,11 @@ class WP_Http_Curl {
$theBody = $theResponse;
// If no response
if ( 0 == strlen($theResponse) && empty( $theHeaders ) ) {
if ( $curl_error = curl_error($handle) )
return new WP_Error('http_request_failed', $curl_error);
if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )
return new WP_Error('http_request_failed', __('Too many redirects.'));
if ( 0 == strlen( $theResponse ) && empty( $theHeaders->headers ) ) {
if ( $curl_error = curl_error( $handle ) )
return new WP_Error( 'http_request_failed', $curl_error );
if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ) ) )
return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
}
$this->headers = '';