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`.

Merge of [38255] to the 4.6 branch.

Props swissspidy, peterwilsoncc.
Props azaozz for review.
See #37652.
Built from https://develop.svn.wordpress.org/branches/4.6@38256


git-svn-id: http://core.svn.wordpress.org/branches/4.6@38197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-08-13 18:40:34 +00:00
parent 4d1a6af1ba
commit 9a51ff0799
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.6-RC2-38252';
$wp_version = '4.6-RC2-38256';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.