mirror of
https://github.com/nextcloud/server.git
synced 2024-08-27 17:55:28 +02:00
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>
This commit is contained in:
parent
e758cfcdc8
commit
53a899a1f5
@ -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)));
|
||||
|
@ -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…
Reference in New Issue
Block a user