From d8622b39d6a64ce239504cca73ef9f568865db44 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 31 Mar 2014 20:43:18 +0000 Subject: [PATCH] Forward pingback IP during pingback verification. props tellyworth, nacin. fixes #27613. Built from https://develop.svn.wordpress.org/trunk@27872 git-svn-id: http://core.svn.wordpress.org/trunk@27703 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-xmlrpc-server.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index cc8cdbd0ea..8bbe664e2d 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -5788,11 +5788,18 @@ class wp_xmlrpc_server extends IXR_Server { // very stupid, but gives time to the 'from' server to publish ! 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 $http_api_args = array( 'timeout' => 10, 'redirection' => 0, '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 ) );