Script Loader: Fix protocol-relative URLs for the `preconnect` relation type.

`wp_resource_hints()` parses the URL for the `preconnect` and `dns-prefetch` relation types to ensure correct values for both. While protocol-relative URLs are supported for `dns-prefetch`, the double slash was lost for `preconnect`.

Props swissspidy, peterwilsoncc.
Props azaozz for review.
Fixes #37652.
Built from https://develop.svn.wordpress.org/trunk@38255


git-svn-id: http://core.svn.wordpress.org/trunk@38196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-08-13 18:35:30 +00:00
parent 1691196110
commit 25338b6f02
2 changed files with 4 additions and 5 deletions

View File

@ -2839,12 +2839,11 @@ function wp_resource_hints() {
continue;
}
if ( 'dns-prefetch' === $relation_type ) {
$url = '//' . $parsed['host'];
} else if ( ! empty( $parsed['scheme'] ) ) {
if ( 'preconnect' === $relation_type && ! empty( $parsed['scheme'] ) ) {
$url = $parsed['scheme'] . '://' . $parsed['host'];
} else {
$url = $parsed['host'];
// Use protocol-relative URLs for dns-prefetch or if scheme is missing.
$url = '//' . $parsed['host'];
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38254';
$wp_version = '4.7-alpha-38255';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.