Forward pingback IP during pingback verification.

Merges [27872] to the 3.7 branch.

props tellyworth, nacin.
fixes #27613.

Built from https://develop.svn.wordpress.org/branches/3.7@27878


git-svn-id: http://core.svn.wordpress.org/branches/3.7@27709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-31 21:36:11 +00:00
parent a9ce0ee825
commit 2486cbe932

View File

@ -5391,11 +5391,18 @@ class wp_xmlrpc_server extends IXR_Server {
// very stupid, but gives time to the 'from' server to publish ! // very stupid, but gives time to the 'from' server to publish !
sleep(1); sleep(1);
$remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $GLOBALS['wp_version'] . '; ' . get_bloginfo( 'url' ) );
// Let's check the remote site // Let's check the remote site
$http_api_args = array( $http_api_args = array(
'timeout' => 10, 'timeout' => 10,
'redirection' => 0, 'redirection' => 0,
'limit_response_size' => 153600, // 150 KB 'limit_response_size' => 153600, // 150 KB
'user-agent' => "$user_agent; verifying pingback from $remote_ip",
'headers' => array(
'X-Pingback-Forwarded-For' => $remote_ip,
),
); );
$linea = wp_remote_retrieve_body( wp_safe_remote_get( $pagelinkedfrom, $http_api_args ) ); $linea = wp_remote_retrieve_body( wp_safe_remote_get( $pagelinkedfrom, $http_api_args ) );