Skip to content

Commit baa4c8b

Browse files
author
ocean90
committed
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
1 parent 90f9f02 commit baa4c8b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

wp-includes/general-template.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,12 +2839,11 @@ function wp_resource_hints() {
28392839
continue;
28402840
}
28412841

2842-
if ( 'dns-prefetch' === $relation_type ) {
2843-
$url = '//' . $parsed['host'];
2844-
} else if ( ! empty( $parsed['scheme'] ) ) {
2842+
if ( 'preconnect' === $relation_type && ! empty( $parsed['scheme'] ) ) {
28452843
$url = $parsed['scheme'] . '://' . $parsed['host'];
28462844
} else {
2847-
$url = $parsed['host'];
2845+
// Use protocol-relative URLs for dns-prefetch or if scheme is missing.
2846+
$url = '//' . $parsed['host'];
28482847
}
28492848
}
28502849

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @global string $wp_version
66
*/
7-
$wp_version = '4.7-alpha-38254';
7+
$wp_version = '4.7-alpha-38255';
88

99
/**
1010
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)