Changeset 23603
- Timestamp:
- 03/04/2013 04:10:36 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-http.php
r23602 r23603 780 780 if ( isset($arrHeaders['headers']['location']) && 0 !== $r['_redirection'] ) { 781 781 if ( $r['redirection']-- > 0 ) { 782 return $this->request( WP_HTTP::make_absolute_url( $arrHeaders['headers']['location'], $url ), $r);782 return wp_remote_request( WP_HTTP::make_absolute_url( $arrHeaders['headers']['location'], $url ), $r); 783 783 } else { 784 784 return new WP_Error('http_request_failed', __('Too many redirects.')); … … 890 890 'method' => strtoupper($r['method']), 891 891 'user_agent' => $r['user-agent'], 892 'max_redirects' => $r['redirection'] + 1, // See #11557 892 'max_redirects' => 0, // Follow no redirects 893 'follow_redirects' => false, 893 894 'protocol_version' => (float) $r['httpversion'], 894 895 'header' => $strHeaders, … … 963 964 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); 964 965 965 // Streams does not provide an error code which we can use to see why the request stream stopped. 966 // We can however test to see if a location header is present and return based on that. 967 if ( isset($processedHeaders['headers']['location']) && 0 !== $args['_redirection'] ) 968 return new WP_Error('http_request_failed', __('Too many redirects.')); 966 if ( ! empty( $processedHeaders['headers']['location'] ) && 0 !== $r['_redirection'] ) { // _redirection: The requested number of redirections 967 if ( $r['redirection']-- > 0 ) { 968 return wp_remote_request( WP_HTTP::make_absolute_url( $processedHeaders['headers']['location'], $url ), $r ); 969 } else { 970 return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); 971 } 972 } 969 973 970 974 if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] ) … … 1181 1185 if ( ! empty( $theHeaders['headers']['location'] ) && 0 !== $r['_redirection'] ) { // _redirection: The requested number of redirections 1182 1186 if ( $r['redirection']-- > 0 ) { 1183 return $this->request( WP_HTTP::make_absolute_url( $theHeaders['headers']['location'], $url ), $r );1187 return wp_remote_request( WP_HTTP::make_absolute_url( $theHeaders['headers']['location'], $url ), $r ); 1184 1188 } else { 1185 1189 return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
Note: See TracChangeset
for help on using the changeset viewer.