WP_HTTP: Fsockopen: Respect a specified Host header in the Fsockopen WP_HTTP transport. Fixes #24182

git-svn-id: https://develop.svn.wordpress.org/trunk@24845 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2013-07-29 01:47:01 +00:00
parent 685fd7fdea
commit 9ebe1e049b
1 changed files with 8 additions and 0 deletions

View File

@ -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) )