Changeset 24483 for branches/3.5
- Timestamp:
- 06/21/2013 06:22:16 AM (11 years ago)
- Location:
- branches/3.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.5
- Property svn:mergeinfo changed
/trunk merged: 23603,23608
- Property svn:mergeinfo changed
-
branches/3.5/wp-includes/class-http.php
r24481 r24483 110 110 $r = apply_filters( 'http_request_args', $r, $url ); 111 111 112 // Certain classes decrement this, store a copy of the original value for loop purposes. 113 $r['_redirection'] = $r['redirection']; 112 // The transports decrement this, store a copy of the original value for loop purposes. 113 if ( ! isset( $r['_redirection'] ) ) 114 $r['_redirection'] = $r['redirection']; 114 115 115 116 // Allow plugins to short-circuit the request … … 783 784 if ( isset($arrHeaders['headers']['location']) && 0 !== $r['_redirection'] ) { 784 785 if ( $r['redirection']-- > 0 ) { 785 return $this->request( WP_HTTP::make_absolute_url( $arrHeaders['headers']['location'], $url ), $r);786 return wp_remote_request( WP_HTTP::make_absolute_url( $arrHeaders['headers']['location'], $url ), $r); 786 787 } else { 787 788 return new WP_Error('http_request_failed', __('Too many redirects.')); … … 893 894 'method' => strtoupper($r['method']), 894 895 'user_agent' => $r['user-agent'], 895 'max_redirects' => $r['redirection'] + 1, // See #11557 896 'max_redirects' => 0, // Follow no redirects 897 'follow_redirects' => false, 896 898 'protocol_version' => (float) $r['httpversion'], 897 899 'header' => $strHeaders, … … 966 968 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); 967 969 968 // Streams does not provide an error code which we can use to see why the request stream stopped. 969 // We can however test to see if a location header is present and return based on that. 970 if ( isset($processedHeaders['headers']['location']) && 0 !== $args['_redirection'] ) 971 return new WP_Error('http_request_failed', __('Too many redirects.')); 970 if ( ! empty( $processedHeaders['headers']['location'] ) && 0 !== $r['_redirection'] ) { // _redirection: The requested number of redirections 971 if ( $r['redirection']-- > 0 ) { 972 return wp_remote_request( WP_HTTP::make_absolute_url( $processedHeaders['headers']['location'], $url ), $r ); 973 } else { 974 return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); 975 } 976 } 972 977 973 978 if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] ) … … 1186 1191 if ( ! empty( $theHeaders['headers']['location'] ) && 0 !== $r['_redirection'] ) { // _redirection: The requested number of redirections 1187 1192 if ( $r['redirection']-- > 0 ) { 1188 return $this->request( WP_HTTP::make_absolute_url( $theHeaders['headers']['location'], $url ), $r );1193 return wp_remote_request( WP_HTTP::make_absolute_url( $theHeaders['headers']['location'], $url ), $r ); 1189 1194 } else { 1190 1195 return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
Note: See TracChangeset
for help on using the changeset viewer.