From 25338b6f029e4360c063aaf3e9a3a1db3c64bc58 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Sat, 13 Aug 2016 18:35:30 +0000 Subject: [PATCH] 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 --- wp-includes/general-template.php | 7 +++---- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 4e049d5714..12ffd4a91e 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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']; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2e75a7e808..2d73fe581d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.