mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 15:16:29 +01:00
HTTP API: Add the URL as a paramter to various HTTP related filters.
Props paulschreiber, purnendu Fixes #42186 Built from https://develop.svn.wordpress.org/trunk@42682 git-svn-id: http://core.svn.wordpress.org/trunk@42510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
427ae1692d
commit
b1ed10ab9a
@ -152,45 +152,52 @@ class WP_Http {
|
|||||||
* Filters the timeout value for an HTTP request.
|
* Filters the timeout value for an HTTP request.
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
|
* @since 5.0.0 The `$url` parameter was added.
|
||||||
*
|
*
|
||||||
* @param int $timeout_value Time in seconds until a request times out.
|
* @param int $timeout_value Time in seconds until a request times out. Default 5.
|
||||||
* Default 5.
|
* @param string $url The request URL.
|
||||||
*/
|
*/
|
||||||
'timeout' => apply_filters( 'http_request_timeout', 5 ),
|
'timeout' => apply_filters( 'http_request_timeout', 5, $url ),
|
||||||
/**
|
/**
|
||||||
* Filters the number of redirects allowed during an HTTP request.
|
* Filters the number of redirects allowed during an HTTP request.
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
|
* @since 5.0.0 The `$url` parameter was added.
|
||||||
*
|
*
|
||||||
* @param int $redirect_count Number of redirects allowed. Default 5.
|
* @param int $redirect_count Number of redirects allowed. Default 5.
|
||||||
|
* @param string $url The request URL.
|
||||||
*/
|
*/
|
||||||
'redirection' => apply_filters( 'http_request_redirection_count', 5 ),
|
'redirection' => apply_filters( 'http_request_redirection_count', 5, $url ),
|
||||||
/**
|
/**
|
||||||
* Filters the version of the HTTP protocol used in a request.
|
* Filters the version of the HTTP protocol used in a request.
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
|
* @since 5.0.0 The `$url` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $version Version of HTTP used. Accepts '1.0' and '1.1'.
|
* @param string $version Version of HTTP used. Accepts '1.0' and '1.1'. Default '1.0'.
|
||||||
* Default '1.0'.
|
* @param string $url The request URL.
|
||||||
*/
|
*/
|
||||||
'httpversion' => apply_filters( 'http_request_version', '1.0' ),
|
'httpversion' => apply_filters( 'http_request_version', '1.0', $url ),
|
||||||
/**
|
/**
|
||||||
* Filters the user agent value sent with an HTTP request.
|
* Filters the user agent value sent with an HTTP request.
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
|
* @since 5.0.0 The `$url` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $user_agent WordPress user agent string.
|
* @param string $user_agent WordPress user agent string.
|
||||||
|
* @param string $url The request URL.
|
||||||
*/
|
*/
|
||||||
'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) ),
|
'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url ),
|
||||||
/**
|
/**
|
||||||
* Filters whether to pass URLs through wp_http_validate_url() in an HTTP request.
|
* Filters whether to pass URLs through wp_http_validate_url() in an HTTP request.
|
||||||
*
|
*
|
||||||
* @since 3.6.0
|
* @since 3.6.0
|
||||||
|
* @since 5.0.0 The `$url` parameter was added.
|
||||||
*
|
*
|
||||||
* @param bool $pass_url Whether to pass URLs through wp_http_validate_url().
|
* @param bool $pass_url Whether to pass URLs through wp_http_validate_url(). Default false.
|
||||||
* Default false.
|
* @param string $url The request URL.
|
||||||
*/
|
*/
|
||||||
'reject_unsafe_urls' => apply_filters( 'http_request_reject_unsafe_urls', false ),
|
'reject_unsafe_urls' => apply_filters( 'http_request_reject_unsafe_urls', false, $url ),
|
||||||
'blocking' => true,
|
'blocking' => true,
|
||||||
'headers' => array(),
|
'headers' => array(),
|
||||||
'cookies' => array(),
|
'cookies' => array(),
|
||||||
@ -350,10 +357,12 @@ class WP_Http {
|
|||||||
* Filters whether SSL should be verified for non-local requests.
|
* Filters whether SSL should be verified for non-local requests.
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
|
* @since 5.0.0 The `$url` parameter was added.
|
||||||
*
|
*
|
||||||
* @param bool $ssl_verify Whether to verify the SSL connection. Default true.
|
* @param bool $ssl_verify Whether to verify the SSL connection. Default true.
|
||||||
|
* @param string $url The request URL.
|
||||||
*/
|
*/
|
||||||
$options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'] );
|
$options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'], $url );
|
||||||
|
|
||||||
// Check for proxies.
|
// Check for proxies.
|
||||||
$proxy = new WP_HTTP_Proxy();
|
$proxy = new WP_HTTP_Proxy();
|
||||||
|
@ -113,10 +113,10 @@ class WP_Http_Curl {
|
|||||||
$ssl_verify = isset( $r['sslverify'] ) && $r['sslverify'];
|
$ssl_verify = isset( $r['sslverify'] ) && $r['sslverify'];
|
||||||
if ( $is_local ) {
|
if ( $is_local ) {
|
||||||
/** This filter is documented in wp-includes/class-wp-http-streams.php */
|
/** This filter is documented in wp-includes/class-wp-http-streams.php */
|
||||||
$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
|
$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
|
||||||
} elseif ( ! $is_local ) {
|
} elseif ( ! $is_local ) {
|
||||||
/** This filter is documented in wp-includes/class-http.php */
|
/** This filter is documented in wp-includes/class-http.php */
|
||||||
$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify );
|
$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -97,13 +97,15 @@ class WP_Http_Streams {
|
|||||||
* Filters whether SSL should be verified for local requests.
|
* Filters whether SSL should be verified for local requests.
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
|
* @since 5.0.0 The `$url` parameter was added.
|
||||||
*
|
*
|
||||||
* @param bool $ssl_verify Whether to verify the SSL connection. Default true.
|
* @param bool $ssl_verify Whether to verify the SSL connection. Default true.
|
||||||
|
* @param string $url The request URL.
|
||||||
*/
|
*/
|
||||||
$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
|
$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
|
||||||
} elseif ( ! $is_local ) {
|
} elseif ( ! $is_local ) {
|
||||||
/** This filter is documented in wp-includes/class-http.php */
|
/** This filter is documented in wp-includes/class-http.php */
|
||||||
$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify );
|
$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url );
|
||||||
}
|
}
|
||||||
|
|
||||||
$proxy = new WP_HTTP_Proxy();
|
$proxy = new WP_HTTP_Proxy();
|
||||||
|
@ -6744,7 +6744,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||||||
$remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
|
$remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
|
||||||
|
|
||||||
/** This filter is documented in wp-includes/class-http.php */
|
/** This filter is documented in wp-includes/class-http.php */
|
||||||
$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) );
|
$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url );
|
||||||
|
|
||||||
// Let's check the remote site
|
// Let's check the remote site
|
||||||
$http_api_args = array(
|
$http_api_args = array(
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42681';
|
$wp_version = '5.0-alpha-42682';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user