From 7d5293d834aa1b2bab4037fb18791c9414482bb9 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 31 Jul 2009 09:37:45 +0000 Subject: [PATCH] add some filters so that HTTP requests can be filtered. props johnbillion. fixes #10413 git-svn-id: https://develop.svn.wordpress.org/trunk@11758 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/http.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/http.php b/wp-includes/http.php index cc63f5c66c..0560940a76 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -236,6 +236,11 @@ class WP_Http { $r = wp_parse_args( $args, $defaults ); $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); if ( $this->block_request( $url ) ) @@ -306,7 +311,7 @@ class WP_Http { do_action( 'http_api_debug', $response, 'response', get_class($transport) ); if ( ! is_wp_error($response) ) - return $response; + return apply_filters( 'http_response', $response, $r, $url ); } return $response;