Make WordPress Core


Ignore:
Timestamp:
10/08/2014 05:57:15 AM (12 years ago)
Author:
dd32
Message:

Correctly support Schemeless URLs in WP_HTTP::make_absolute_url() by respecting the 'host' field if present in the relative url.
Fixes #29886

File:
1 edited

Legend:

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

    r29850 r29851  
    687687                }
    688688
    689                 $absolute_path = $url_parts['scheme'] . '://' . $url_parts['host'];
    690                 if ( isset( $url_parts['port'] ) )
    691                         $absolute_path .= ':' . $url_parts['port'];
     689                $absolute_path = $url_parts['scheme'] . '://';
     690
     691                // Schemeless URL's will make it this far, so we check for a host in the relative url and convert it to a protocol-url
     692                if ( isset( $relative_url_parts['host'] ) ) {
     693                        $absolute_path .= $relative_url_parts['host'];
     694                        if ( isset( $relative_url_parts['port'] ) )
     695                                $absolute_path .= ':' . $relative_url_parts['port'];
     696                } else {
     697                        $absolute_path .= $url_parts['host'];
     698                        if ( isset( $url_parts['port'] ) )
     699                                $absolute_path .= ':' . $url_parts['port'];
     700                }
    692701
    693702                // Start off with the Absolute URL path.
Note: See TracChangeset for help on using the changeset viewer.