Browse Source

Fix the HTTP 1.0 status code and properly detect 1.0 vs 1.1&2.0

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
tags/v14.0.0beta1
Morris Jobke 6 years ago
parent
commit
53a899a1f5
No account linked to committer's email address
2 changed files with 8 additions and 8 deletions
  1. 3
    3
      apps/files_sharing/public.php
  2. 5
    5
      lib/private/legacy/response.php

+ 3
- 3
apps/files_sharing/public.php View File



if($token !== '') { if($token !== '') {
$protocol = \OC::$server->getRequest()->getHttpProtocol(); $protocol = \OC::$server->getRequest()->getHttpProtocol();
if ($protocol == 'HTTP/1.1') {
$status = '307 Temporary Redirect';
if ($protocol == 'HTTP/1.0') {
$status = '302 Found';
} else { } else {
$status = '304 Found';
$status = '307 Temporary Redirect';
} }
header($protocol.' ' . $status); header($protocol.' ' . $status);
header('Location: ' . $urlGenerator->linkToRoute($route, array('token' => $token))); header('Location: ' . $urlGenerator->linkToRoute($route, array('token' => $token)));

+ 5
- 5
lib/private/legacy/response.php View File

*/ */


class OC_Response { class OC_Response {
const STATUS_FOUND = 304;
const STATUS_FOUND = 302;
const STATUS_NOT_MODIFIED = 304; const STATUS_NOT_MODIFIED = 304;
const STATUS_TEMPORARY_REDIRECT = 307; const STATUS_TEMPORARY_REDIRECT = 307;
const STATUS_BAD_REQUEST = 400; const STATUS_BAD_REQUEST = 400;
$status = $status . ' Not Modified'; $status = $status . ' Not Modified';
break; break;
case self::STATUS_TEMPORARY_REDIRECT: case self::STATUS_TEMPORARY_REDIRECT:
if ($protocol == 'HTTP/1.1') {
$status = $status . ' Temporary Redirect';
break;
} else {
if ($protocol == 'HTTP/1.0') {
$status = self::STATUS_FOUND; $status = self::STATUS_FOUND;
// fallthrough // fallthrough
} else {
$status = $status . ' Temporary Redirect';
break;
} }
case self::STATUS_FOUND; case self::STATUS_FOUND;
$status = $status . ' Found'; $status = $status . ' Found';

Loading…
Cancel
Save