WordPress.org

Make WordPress Core

Ticket #2875: 2875.diff

File 2875.diff, 1.2 KB (added by Nazgul, 11 years ago)
  • wp-includes/functions.php

     
    506506        $punc = '.:?\-';
    507507        $any = $ltrs . $gunk . $punc;
    508508
    509         preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp);
     509        preg_match_all("{\b https? : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp);
    510510
    511511        debug_fwrite($log, 'Post contents:');
    512512        debug_fwrite($log, $content."\n");
     
    547547        $parts = parse_url( $url );
    548548        $file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : '');
    549549        $host = $parts['host'];
    550         if ( !isset( $parts['port'] ) )
    551                 $parts['port'] = 80;
     550        $scheme = "";
     551        if ( $parts['scheme'] == "https" )
     552                $scheme = "ssl://";
     553        if ( !isset( $parts['port'] ) ) {
     554                if($scheme) {
     555                        $parts['port'] = 443;
     556                } else {
     557                        $parts['port'] = 80;
     558                }
     559        }       
    552560
    553561        $head = "HEAD $file HTTP/1.1\r\nHOST: $host\r\nUser-Agent: WordPress/" . $wp_version . "\r\n\r\n";
    554562
    555         $fp = @fsockopen($host, $parts['port'], $err_num, $err_msg, 3);
     563        $fp = @fsockopen($scheme.$host, $parts['port'], $err_num, $err_msg, 3);
    556564        if ( !$fp )
    557565                return false;
    558566