From d6656cc1f1fb6fa8d97d90da2f88d53bc47ce2a8 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 29 Jul 2013 01:47:01 +0000 Subject: [PATCH] WP_HTTP: Fsockopen: Respect a specified Host header in the Fsockopen WP_HTTP transport. Fixes #24182 git-svn-id: http://core.svn.wordpress.org/trunk@24845 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-http.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 541ae56c71..cfd4d47c45 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -693,6 +693,14 @@ class WP_Http_Fsockopen { } } + if ( isset( $r['headers']['Host'] ) || isset( $r['headers']['host'] ) ) { + if ( isset( $r['headers']['Host'] ) ) + $arrURL['host'] = $r['headers']['Host']; + else + $arrURL['host'] = $r['headers']['host']; + unset( $r['headers']['Host'], $r['headers']['host'] ); + } + //fsockopen has issues with 'localhost' with IPv6 with certain versions of PHP, It attempts to connect to ::1, // which fails when the server is not set up for it. For compatibility, always connect to the IPv4 address. if ( 'localhost' == strtolower($fsockopen_host) )