add some filters so that HTTP requests can be filtered. props johnbillion. fixes #10413

git-svn-id: http://svn.automattic.com/wordpress/trunk@11758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2009-07-31 09:37:45 +00:00
parent 5141747487
commit 8bd3d6cab9
1 changed files with 6 additions and 1 deletions

View File

@ -236,6 +236,11 @@ class WP_Http {
$r = wp_parse_args( $args, $defaults ); $r = wp_parse_args( $args, $defaults );
$r = apply_filters( 'http_request_args', $r, $url ); $r = apply_filters( 'http_request_args', $r, $url );
// Allow plugins to short-circuit the request
$pre = apply_filters( 'pre_http_request', false, $r, $url );
if ( false !== $pre )
return $pre;
$arrURL = parse_url($url); $arrURL = parse_url($url);
if ( $this->block_request( $url ) ) if ( $this->block_request( $url ) )
@ -306,7 +311,7 @@ class WP_Http {
do_action( 'http_api_debug', $response, 'response', get_class($transport) ); do_action( 'http_api_debug', $response, 'response', get_class($transport) );
if ( ! is_wp_error($response) ) if ( ! is_wp_error($response) )
return $response; return apply_filters( 'http_response', $response, $r, $url );
} }
return $response; return $response;