Skip to content

Commit e1d8404

Browse files
committed
Issue warning when falling back to unsecure request
1 parent 0ce9b1c commit e1d8404

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Scaffold_Command.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,10 @@ public function _s( $args, $assoc_args ) {
414414
// See https://github.com/wp-cli/scaffold-command/issues/181
415415
if ( is_wp_error( $response )
416416
&& false !== strpos( $response->get_error_message(), 'gnutls_handshake() failed' ) ) {
417-
// Try again with HTTP instead of HTTPS.
418-
$url = str_replace( 'https://', 'http://', $url );
419-
$response = wp_remote_post( $url, $post_args );
417+
// Certificate problem, falling back to unsecured request instead.
418+
$alt_url = str_replace( 'https://', 'http://', $url );
419+
WP_CLI::warning( "Secured request to {$url} failed, using {$alt_url} as a fallback." );
420+
$response = wp_remote_post( $alt_url, $post_args );
420421
}
421422

422423
if ( is_wp_error( $response ) ) {

0 commit comments

Comments
 (0)