Ticket #8727: 8727.diff
File 8727.diff, 2.6 KB (added by , 17 years ago) |
---|
-
http.php
30 30 * requirement, it will be easy to add the static keyword to the code. It is not 31 31 * as easy to convert a function to a method after enough code uses the old way. 32 32 * 33 * Debugging includes several actions, which pass different variables for 34 * debugging the HTTP API. 35 * 36 * <strong>http_transport_get_debug</strong> - gives working, nonblocking, and 37 * blocking transports. 38 * 39 * <strong>http_transport_post_debug</strong> - gives working, nonblocking, and 40 * blocking transports. 41 * 33 42 * @package WordPress 34 43 * @subpackage HTTP 35 44 * @since 2.7 … … 114 123 } 115 124 } 116 125 126 if( has_filter('http_transport_get_debug') ) 127 do_action('http_transport_get_debug', $working_transport, $blocking_transport, $nonblocking_transport); 128 117 129 if ( isset($args['blocking']) && !$args['blocking'] ) 118 130 return $nonblocking_transport; 119 131 else … … 156 168 } 157 169 } 158 170 171 if( has_filter('http_transport_post_debug') ) 172 do_action('http_transport_post_debug', $working_transport, $blocking_transport, $nonblocking_transport); 173 159 174 if ( isset($args['blocking']) && !$args['blocking'] ) 160 175 return $nonblocking_transport; 161 176 else … … 257 272 $transports = WP_Http::_postTransport($r); 258 273 } 259 274 275 if( has_action('http_api_debug') ) 276 do_action('http_api_debug', $transports, 'transports_list'); 277 260 278 $response = array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') ); 261 279 foreach( (array) $transports as $transport ) { 262 280 $response = $transport->request($url, $r); 263 281 264 if( !is_wp_error($response) ) 282 if( has_action('http_api_debug') ) 283 do_action( 'http_api_debug', $response, 'response', get_class($transport) ); 284 285 if( ! is_wp_error($response) ) 265 286 return $response; 266 287 } 267 288 … … 409 430 410 431 if ( $hasChunk ) { 411 432 if ( empty($match[1]) ) { 412 return new WP_Error('http_chunked_decode', __('Does not appear to be chunked encoded or body is malformed.') );433 return $body; 413 434 } 414 435 415 436 $length = hexdec( $match[1] ); … … 426 447 break; 427 448 } 428 449 } else { 429 return new WP_Error('http_chunked_decode', __('Does not appear to be chunked encoded or body is malformed.') );450 return $body; 430 451 } 431 452 } while ( false === $done ); 432 453 } … … 1019 1040 else 1020 1041 curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); 1021 1042 1043 do_action_ref_array( 'http_api_curl', &$handle ); 1044 1022 1045 if ( ! $r['blocking'] ) { 1023 1046 curl_exec( $handle ); 1024 1047 curl_close( $handle );