Make WordPress Core

Changeset 11154


Ignore:
Timestamp:
05/01/2009 11:53:38 PM (17 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/http.php

    r11143 r11154  
    605605                $arrURL = parse_url($url);
    606606
     607                $fsockopen_host = $arrURL['host'];
     608
    607609                $secure_transport = false;
    608610
    609                 if ( ! isset($arrURL['port']) ) {
    610                         if ( ($arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https') && extension_loaded('openssl') ) {
    611                                 $arrURL['host'] = 'ssl://' . $arrURL['host'];
     611                if ( ! isset( $arrURL['port'] ) ) {
     612                        if ( ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) && extension_loaded('openssl') ) {
     613                                $fsockopen_host = "ssl://$fsockopen_host";
    612614                                $arrURL['port'] = 443;
    613615                                $secure_transport = true;
     
    628630                if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) {
    629631                        if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
    630                                 $handle = @fsockopen($proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
     632                                $handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
    631633                        else
    632                                 $handle = @fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, $r['timeout'] );
     634                                $handle = @fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
    633635                } else {
    634636                        if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
    635                                 $handle = fsockopen($proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
     637                                $handle = fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
    636638                        else
    637                                 $handle = fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, $r['timeout'] );
     639                                $handle = fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
    638640                }
    639641
     
    20022004 */
    20032005function wp_remote_retrieve_response_code(&$response) {
    2004         if ( is_wp_error($response) ||! isset($response['response']) || ! is_array($response['response']))
     2006        if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
    20052007                return '';
    20062008
Note: See TracChangeset for help on using the changeset viewer.