Make WordPress Core


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

Correctly handle url's containing url's in WP_HTTP::make_absolute_url().
A valid relative URL could be mistaken for an absolute url if it contained a : in any position of the url.
Fixes #28001

File:
1 edited

Legend:

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

    r29849 r29850  
    676676                        return $maybe_relative_path;
    677677
    678                 // Check for a scheme.
    679                 if ( false !== strpos( $maybe_relative_path, '://' ) )
    680                         return $maybe_relative_path;
    681 
    682678                if ( ! $url_parts = @parse_url( $url ) )
    683679                        return $maybe_relative_path;
    … …  
    685681                if ( ! $relative_url_parts = @parse_url( $maybe_relative_path ) )
    686682                        return $maybe_relative_path;
     683
     684                // Check for a scheme on the 'relative' url
     685                if ( ! empty( $relative_url_parts['scheme'] ) ) {
     686                        return $maybe_relative_path;
     687                }
    687688
    688689                $absolute_path = $url_parts['scheme'] . '://' . $url_parts['host'];
Note: See TracChangeset for help on using the changeset viewer.