mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Correctly support Schemeless URLs in WP_HTTP::make_absolute_url() by respecting the 'host' field if present in the relative url.
Fixes #29886 git-svn-id: https://develop.svn.wordpress.org/trunk@29851 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -686,9 +686,18 @@ class WP_Http {
|
||||
return $maybe_relative_path;
|
||||
}
|
||||
|
||||
$absolute_path = $url_parts['scheme'] . '://' . $url_parts['host'];
|
||||
if ( isset( $url_parts['port'] ) )
|
||||
$absolute_path .= ':' . $url_parts['port'];
|
||||
$absolute_path = $url_parts['scheme'] . '://';
|
||||
|
||||
// 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
|
||||
if ( isset( $relative_url_parts['host'] ) ) {
|
||||
$absolute_path .= $relative_url_parts['host'];
|
||||
if ( isset( $relative_url_parts['port'] ) )
|
||||
$absolute_path .= ':' . $relative_url_parts['port'];
|
||||
} else {
|
||||
$absolute_path .= $url_parts['host'];
|
||||
if ( isset( $url_parts['port'] ) )
|
||||
$absolute_path .= ':' . $url_parts['port'];
|
||||
}
|
||||
|
||||
// Start off with the Absolute URL path.
|
||||
$path = ! empty( $url_parts['path'] ) ? $url_parts['path'] : '/';
|
||||
|
||||
Reference in New Issue
Block a user