Make WordPress Core

Changeset 10579


Ignore:
Timestamp:
02/15/2009 08:56:54 PM (18 years ago)
Author:
ryan
Message:

discover_pingback_server_uri optimizations. Props DD32. fixes #8816

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r10564 r10579  
    12551255                return false;
    12561256
    1257         $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.1' ) );
     1257        //Do not search for a pingback server on our own uploads
     1258        $uploads_dir = wp_upload_dir();
     1259        if ( 0 === strpos($url, $uploads_dir['baseurl']) )
     1260                return false;
     1261
     1262        $response = wp_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
    12581263
    12591264        if ( is_wp_error( $response ) )
    … …  
    12651270        // Not an (x)html, sgml, or xml page, no use going further.
    12661271        if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )
     1272                return false;
     1273
     1274        // Now do a GET since we're going to look in the html headers (and we're sure its not a binary file)
     1275        $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
     1276
     1277        if ( is_wp_error( $response ) )
    12671278                return false;
    12681279
Note: See TracChangeset for help on using the changeset viewer.