Send valid host when using WP_Http_Fsockopen over SSL. Props mdawaffe. fixes #9699

git-svn-id: http://svn.automattic.com/wordpress/trunk@11154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-05-01 23:53:38 +00:00
parent 7fc314e858
commit 31e805261c
1 changed files with 10 additions and 8 deletions

View File

@ -604,11 +604,13 @@ class WP_Http_Fsockopen {
$arrURL = parse_url($url);
$fsockopen_host = $arrURL['host'];
$secure_transport = false;
if ( ! isset( $arrURL['port'] ) ) {
if ( ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) && extension_loaded('openssl') ) {
$arrURL['host'] = 'ssl://' . $arrURL['host'];
$fsockopen_host = "ssl://$fsockopen_host";
$arrURL['port'] = 443;
$secure_transport = true;
} else {
@ -629,12 +631,12 @@ class WP_Http_Fsockopen {
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
$handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
else
$handle = @fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, $r['timeout'] );
$handle = @fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
} else {
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
$handle = fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
else
$handle = fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, $r['timeout'] );
$handle = fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
}
$endDelay = time();