Skip to content
Permalink
Browse files

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.

git-svn-id: https://develop.svn.wordpress.org/trunk@46231 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
ocean90 committed Sep 21, 2019
1 parent e6ea695 commit 144c5f760d85810dd0fa069b7f6966e4611424d2
@@ -95,6 +95,8 @@ public function test_wp_version_check_attached() {
$headers = array(
'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.
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
@@ -108,7 +110,7 @@ public function test_wp_version_check_attached() {
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 ) ) {
return array(
@@ -1677,6 +1677,8 @@ public function get_test_rest_availability() {
'Cache-Control' => 'no-cache',
'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.
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
@@ -1693,7 +1695,7 @@ public function get_test_rest_availability() {
$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 ) ) {
$result['status'] = 'critical';
@@ -2000,6 +2002,8 @@ function can_perform_loopback() {
$headers = array(
'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.
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
@@ -2008,7 +2012,7 @@ function can_perform_loopback() {
$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 ) ) {
return (object) array(

0 comments on commit 144c5f7

Please sign in to comment.
You can’t perform that action at this time.