Просмотр исходного кода

Avoid prototol-relative URLs

Protocol-relative URLs do not seem to work well with API / mobile apps
Alexandre Alapetite 10 лет назад
Родитель
Сommit
0f870e800b
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      lib/SimplePie/SimplePie/Misc.php

+ 3 - 3
lib/SimplePie/SimplePie/Misc.php

@@ -83,14 +83,14 @@ class SimplePie_Misc
 	 */
 	public static function https_url($url)
 	{
-		return preg_replace('%^http://((?:[^/]*?\.)?(?:youtube|dailymotion|tumblr)\.com/)%i', '//$1', $url);
+		return preg_replace('%^http://((?:[^/]*?\.)?(?:youtube|dailymotion|tumblr)\.com/)%i', 'https://$1', $url);
 	}
 
 	public static function absolutize_url($relative, $base)
 	{
 		if (substr($relative, 0, 2) === '//')
-		{//Allow protocol-relative URLs "//www.example.net" which will pick HTTP or HTTPS automatically
-			return $relative;
+		{//Protocol-relative URLs "//www.example.net"
+			return 'https:' . $relative;
 		}
 		$iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
 		if ($iri === false)