Skip to content

Commit

Permalink
Issue warning when falling back to unsecure request
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Oct 25, 2018
1 parent 0ce9b1c commit e1d8404
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Scaffold_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,10 @@ public function _s( $args, $assoc_args ) {
// See https://github.com/wp-cli/scaffold-command/issues/181
if ( is_wp_error( $response )
&& false !== strpos( $response->get_error_message(), 'gnutls_handshake() failed' ) ) {
// Try again with HTTP instead of HTTPS.
$url = str_replace( 'https://', 'http://', $url );
$response = wp_remote_post( $url, $post_args );
// Certificate problem, falling back to unsecured request instead.
$alt_url = str_replace( 'https://', 'http://', $url );
WP_CLI::warning( "Secured request to {$url} failed, using {$alt_url} as a fallback." );
$response = wp_remote_post( $alt_url, $post_args );
}

if ( is_wp_error( $response ) ) {
Expand Down

0 comments on commit e1d8404

Please sign in to comment.