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: https://develop.svn.wordpress.org/trunk@20370 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2012-04-05 11:58:04 +00:00
parent 8578804f80
commit 20141db4eb
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 = '';