WordPress.org

Make WordPress Core

Ticket #16402: 16402.diff

File 16402.diff, 912 bytes (added by garyc40, 7 years ago)

fix WP_HTTP_IXR_Client

  • wp-includes/class-wp-http-ixr-client.php

    diff --git wp-includes/class-wp-http-ixr-client.php wp-includes/class-wp-http-ixr-client.php
    index 4c36334..8768abe 100644
    class WP_HTTP_IXR_Client extends IXR_Client { 
    1111                if ( ! $path ) {
    1212                        // Assume we have been given a URL instead
    1313                        $bits = parse_url($server);
     14                        // Set correct default port based on scheme
     15                        if ( 'https' == $bits['scheme'] ) {
     16                                if ( $port == 80 )
     17                                        $port = 443;
     18                                       
     19                                if ( in_array( 'ssl', stream_get_transports() ) )
     20                                        $bits['scheme'] = 'ssl';
     21                        }
    1422                        $this->scheme = $bits['scheme'];
    1523                        $this->server = $bits['host'];
    16                         $this->port = isset($bits['port']) ? $bits['port'] : 80;
     24                        $this->port = isset($bits['port']) ? $bits['port'] : $port;
    1725                        $this->path = !empty($bits['path']) ? $bits['path'] : '/';
    1826
    1927                        // Make absolutely sure we have a path