aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-03-13 09:22:26 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-03-13 09:22:26 +0100
commit53a899a1f54401c06e361c05f5b739cd895b98a2 (patch)
treea4e0eedf09ef71357f01b6fd9c0916542db5ed6b
parente758cfcdc83bcf30d4e1677fdf6c06614c2167ab (diff)
downloadnextcloud-server-53a899a1f54401c06e361c05f5b739cd895b98a2.tar.gz
nextcloud-server-53a899a1f54401c06e361c05f5b739cd895b98a2.zip
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>
-rw-r--r--apps/files_sharing/public.php6
-rw-r--r--lib/private/legacy/response.php10
2 files changed, 8 insertions, 8 deletions
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 7820455df58..0ca7e8f245e 100644
--- a/apps/files_sharing/public.php
+++ b/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)));
diff --git a/lib/private/legacy/response.php b/lib/private/legacy/response.php
index 0a49eb9643f..4186822c269 100644
--- a/lib/private/legacy/response.php
+++ b/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';