Преглед изворни кода

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 година
родитељ
комит
53a899a1f5
No account linked to committer's email address
2 измењених фајлова са 8 додато и 8 уклоњено
  1. 3
    3
      apps/files_sharing/public.php
  2. 5
    5
      lib/private/legacy/response.php

+ 3
- 3
apps/files_sharing/public.php Прегледај датотеку

@@ -29,10 +29,10 @@ $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare

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

+ 5
- 5
lib/private/legacy/response.php Прегледај датотеку

@@ -31,7 +31,7 @@
*/

class OC_Response {
const STATUS_FOUND = 304;
const STATUS_FOUND = 302;
const STATUS_NOT_MODIFIED = 304;
const STATUS_TEMPORARY_REDIRECT = 307;
const STATUS_BAD_REQUEST = 400;
@@ -51,12 +51,12 @@ class OC_Response {
$status = $status . ' Not Modified';
break;
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;
// fallthrough
} else {
$status = $status . ' Temporary Redirect';
break;
}
case self::STATUS_FOUND;
$status = $status . ' Found';

Loading…
Откажи
Сачувај