Site Health: Don't verify SSL certificate when testing the local site.

The SSL certificate may be self-signed which prevents various tests from returning proper results. Since the Cron API and file editors don't verify the certificate the tests shouldn't either.

Props Clorith, ocean90.
Fixes #47957.
Built from https://develop.svn.wordpress.org/trunk@46231


git-svn-id: http://core.svn.wordpress.org/trunk@46043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2019-09-21 16:06:57 +00:00
parent 4d9c482e79
commit 123b4475b0
3 changed files with 10 additions and 4 deletions

View File

@ -95,6 +95,8 @@ class WP_Site_Health_Auto_Updates {
$headers = array( $headers = array(
'Cache-Control' => 'no-cache', 'Cache-Control' => 'no-cache',
); );
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify = apply_filters( 'https_local_ssl_verify', false );
// Include Basic auth in loopback requests. // Include Basic auth in loopback requests.
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
@ -108,7 +110,7 @@ class WP_Site_Health_Auto_Updates {
admin_url( 'site-health.php' ) admin_url( 'site-health.php' )
); );
$test = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) ); $test = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
if ( is_wp_error( $test ) ) { if ( is_wp_error( $test ) ) {
return array( return array(

View File

@ -1677,6 +1677,8 @@ class WP_Site_Health {
'Cache-Control' => 'no-cache', 'Cache-Control' => 'no-cache',
'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ), 'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ),
); );
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify = apply_filters( 'https_local_ssl_verify', false );
// Include Basic auth in loopback requests. // Include Basic auth in loopback requests.
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
@ -1693,7 +1695,7 @@ class WP_Site_Health {
$url $url
); );
$r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
if ( is_wp_error( $r ) ) { if ( is_wp_error( $r ) ) {
$result['status'] = 'critical'; $result['status'] = 'critical';
@ -2000,6 +2002,8 @@ class WP_Site_Health {
$headers = array( $headers = array(
'Cache-Control' => 'no-cache', 'Cache-Control' => 'no-cache',
); );
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify = apply_filters( 'https_local_ssl_verify', false );
// Include Basic auth in loopback requests. // Include Basic auth in loopback requests.
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
@ -2008,7 +2012,7 @@ class WP_Site_Health {
$url = admin_url(); $url = admin_url();
$r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
if ( is_wp_error( $r ) ) { if ( is_wp_error( $r ) ) {
return (object) array( return (object) array(

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46230'; $wp_version = '5.3-alpha-46231';
/** /**
* 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.