Add more logging, extend WOPI token TTL

This commit is contained in:
bohwaz 2022-10-21 17:34:08 +02:00
parent 07c3711d65
commit 4b30a2c550
3 changed files with 10 additions and 8 deletions

View file

@ -52,6 +52,7 @@ The following NextCloud specific features are supported:
* [FUSE webdavfs](https://github.com/miquels/webdavfs) is recommended for Linux
* davfs2 is NOT recommended: it is very slow, and it is using a local cache, meaning changing a file locally may not be synced to the server for a few minutes, leading to things getting out of sync. If you have to use it, at least disable locks, by setting `use_locks=0` in the config.
* Microsoft Windows native webclient (also called 'MiniRedir') is notoriously bad. We tested it successfully on Windows 10, but it is recommended to use [CyberDuck](https://cyberduck.io/download/) or [WinSCP](https://winscp.net/) instead, both are free software.
## WOPI clients compatibility

View file

@ -200,7 +200,7 @@ class Storage extends AbstractStorage
if (!$token) {
$token = $this->createWopiToken($uri);
$p->set(WOPI::PROP_TOKEN, null, $token);
$p->set(WOPI::PROP_TOKEN_TTL, null, (time()+3600)*1000);
$p->set(WOPI::PROP_TOKEN_TTL, null, (time()+3600*10)*1000);
}
return $token;

View file

@ -8,17 +8,21 @@ $uri = strtok($_SERVER['REQUEST_URI'], '?');
$s = new Server;
$method = $_SERVER['REQUEST_METHOD'] ?? $_SERVER['REDIRECT_REQUEST_METHOD'];
$qs = $_SERVER['QUERY_STRING'] ?? null;
$s->dav->log("<= %s %s", $method, $uri . ($qs ? '?' : '') . $qs);
$s->dav->log('%s', print_r(apache_request_headers(), true));
$s->dav->log('%s', $_SERVER['PHP_AUTH_USER'] ?? 'not logged in');
if (PHP_SAPI == 'cli-server') {
if (is_file(__DIR__ . '/' . $uri)) {
return false;
}
// Index.php
elseif ($uri == '/') {
elseif ($uri == '/' && $method != 'OPTIONS') {
return false;
}
$method = $_SERVER['REQUEST_METHOD'] ?? $_SERVER['REDIRECT_REQUEST_METHOD'];
if ($method != 'GET' && $method != 'HEAD') {
$s->dav->log('%s', file_get_contents('php://input'));
}
@ -30,9 +34,6 @@ if (isset($_SERVER['REDIRECT_REQUEST_METHOD'])) {
if (!$s->route($uri)) {
if (PHP_SAPI == 'cli-server') {
$qs = $_SERVER['QUERY_STRING'] ?? null;
$s->dav->log("<= %s %s", $method, $uri . ($qs ? '?' : '') . $qs);
$s->dav->log('%s', print_r(apache_request_headers(), true));
$s->dav->log("=> Router fail: 404");
}
@ -40,5 +41,5 @@ if (!$s->route($uri)) {
echo '<h1>Invalid URL</h1>';
}
else {
$s->dav->log('=> %d %s %s', http_response_code(), print_r(headers_list(), true), print_r(apache_request_headers(), true));
$s->dav->log('=> %d %s', http_response_code(), print_r(headers_list(), true));
}