Force IPv4 (127.0.0.1) when connecting to localhost, as many dev environments are not set up to serve on IPv6 (::1). props dd32. fixes #10045

git-svn-id: https://develop.svn.wordpress.org/trunk@11759 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2009-07-31 09:40:16 +00:00
parent 7d5293d834
commit 0604c85a91
1 changed files with 5 additions and 0 deletions

View File

@ -630,6 +630,11 @@ class WP_Http_Fsockopen {
} }
} }
//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 setup for it. For compatibility, always connect to the IPv4 address.
if ( 'localhost' == strtolower($fsockopen_host) )
$fsockopen_host = '127.0.0.1';
// There are issues with the HTTPS and SSL protocols that cause errors that can be safely // There are issues with the HTTPS and SSL protocols that cause errors that can be safely
// ignored and should be ignored. // ignored and should be ignored.
if ( true === $secure_transport ) if ( true === $secure_transport )