mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
discover_pingback_server_uri optimizations. Props DD32. fixes #8816
git-svn-id: http://svn.automattic.com/wordpress/trunk@10579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b9d1608150
commit
b5a65633d0
@ -1254,7 +1254,12 @@ function discover_pingback_server_uri($url, $deprecated = 2048) {
|
||||
if ( ! isset( $parsed_url['host'] ) ) // Not an URL. This should never happen.
|
||||
return false;
|
||||
|
||||
$response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.1' ) );
|
||||
//Do not search for a pingback server on our own uploads
|
||||
$uploads_dir = wp_upload_dir();
|
||||
if ( 0 === strpos($url, $uploads_dir['baseurl']) )
|
||||
return false;
|
||||
|
||||
$response = wp_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
|
||||
|
||||
if ( is_wp_error( $response ) )
|
||||
return false;
|
||||
@ -1266,6 +1271,12 @@ function discover_pingback_server_uri($url, $deprecated = 2048) {
|
||||
if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )
|
||||
return false;
|
||||
|
||||
// Now do a GET since we're going to look in the html headers (and we're sure its not a binary file)
|
||||
$response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
|
||||
|
||||
if ( is_wp_error( $response ) )
|
||||
return false;
|
||||
|
||||
$contents = $response['body'];
|
||||
|
||||
$pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
|
||||
|
Loading…
Reference in New Issue
Block a user