From 6b0d172379e30d973997ad6c9dac458138f60b65 Mon Sep 17 00:00:00 2001 From: Jonathon Fowler Date: Mon, 7 Nov 2016 09:55:11 +0800 Subject: [PATCH] MDL-56129 core: Change HTTP error code for iOS 10 video playback This patch changes the effective response code from a 407 to a 403 when erroring on iOS 10 and when a HTTP_X_PLAYBACK_SESSION_ID HTTP header is found. This causes the iOS Media framework to send the cookie with the request which subsequently succeeds. --- lib/outputrenderers.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 14a3d0175c8..848ea10de61 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -2736,6 +2736,9 @@ EOD; $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'); if (empty($_SERVER['HTTP_RANGE'])) { @header($protocol . ' 404 Not Found'); + } else if (core_useragent::check_safari_ios_version(602) && !empty($_SERVER['HTTP_X_PLAYBACK_SESSION_ID'])) { + // Coax iOS 10 into sending the session cookie. + @header($protocol . ' 403 Forbidden'); } else { // Must stop byteserving attempts somehow, // this is weird but Chrome PDF viewer can be stopped only with 407!