Index: trunk/wp-includes/http.php
===================================================================
--- trunk/wp-includes/http.php (revision 10211)
+++ trunk/wp-includes/http.php (revision 10281)
@@ -30,4 +30,13 @@
* requirement, it will be easy to add the static keyword to the code. It is not
* as easy to convert a function to a method after enough code uses the old way.
+ *
+ * Debugging includes several actions, which pass different variables for
+ * debugging the HTTP API.
+ *
+ * http_transport_get_debug - gives working, nonblocking, and
+ * blocking transports.
+ *
+ * http_transport_post_debug - gives working, nonblocking, and
+ * blocking transports.
*
* @package WordPress
@@ -115,4 +124,7 @@
}
+ if( has_filter('http_transport_get_debug') )
+ do_action('http_transport_get_debug', $working_transport, $blocking_transport, $nonblocking_transport);
+
if ( isset($args['blocking']) && !$args['blocking'] )
return $nonblocking_transport;
@@ -157,4 +169,7 @@
}
+ if( has_filter('http_transport_post_debug') )
+ do_action('http_transport_post_debug', $working_transport, $blocking_transport, $nonblocking_transport);
+
if ( isset($args['blocking']) && !$args['blocking'] )
return $nonblocking_transport;
@@ -258,9 +273,15 @@
}
+ if( has_action('http_api_debug') )
+ do_action('http_api_debug', $transports, 'transports_list');
+
$response = array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
foreach( (array) $transports as $transport ) {
$response = $transport->request($url, $r);
- if( !is_wp_error($response) )
+ if( has_action('http_api_debug') )
+ do_action( 'http_api_debug', $response, 'response', get_class($transport) );
+
+ if( ! is_wp_error($response) )
return $response;
}
@@ -410,5 +431,5 @@
if ( $hasChunk ) {
if ( empty($match[1]) ) {
- return new WP_Error('http_chunked_decode', __('Does not appear to be chunked encoded or body is malformed.') );
+ return $body;
}
@@ -427,5 +448,5 @@
}
} else {
- return new WP_Error('http_chunked_decode', __('Does not appear to be chunked encoded or body is malformed.') );
+ return $body;
}
} while ( false === $done );
@@ -1019,4 +1040,6 @@
else
curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
+
+ do_action_ref_array( 'http_api_curl', &$handle );
if ( ! $r['blocking'] ) {