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.
This commit is contained in:
Jonathon Fowler 2016-11-07 09:55:11 +08:00 committed by Andrew Nicols
parent 7eb34671c1
commit 6b0d172379

View File

@ -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!