Close the session for writing when sending a file

Right now, if you download an archive, you won't be able to browse within h5ai until the download is finished. This is because the session data is locked to prevent concurrent writes, which also prevents concurrent requests.

By adding session_write_close() in the on_download function, the session lock is released and concurrent requests will work.
This commit is contained in:
Woet 2020-02-27 11:41:56 +08:00 committed by GitHub
parent ce939c3115
commit 6da08269d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -31,6 +31,7 @@ class Api {
$archive = new Archive($this->context);
set_time_limit(0);
session_write_close();
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $as . '"');
header('Connection: close');