wp-migrate-db icon indicating copy to clipboard operation
wp-migrate-db copied to clipboard

1s timeout is too less to verify the https connection

Open danielmorlock opened this issue 8 years ago • 0 comments

If the remote site is delayed, a 1s timeout for fsockopen() is too less to verify whether the remote site is on:

if( function_exists( 'fsockopen' ) && strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) { 
            $url_parts = parse_url( $url );
            $host = $url_parts['host'];
            if( $pf = @fsockopen( $host, 443, $err, $err_string, 1 ) ) { 
                // worked
                fclose( $pf );
            }   
            else {
                // failed
                $url = substr_replace( $url, 'http', 0, 5 );
            }   
        } 

https://github.com/wp-sync-db/wp-sync-db/blob/master/class/wpsdb-base.php#L86

danielmorlock avatar Nov 30 '16 09:11 danielmorlock