Work around LiteSpeed's truncation of large files

This commit is contained in:
Erik Lundin 2020-02-25 22:42:40 +01:00 committed by Jerome Jutteau
parent 208418c2e0
commit 41cde93bc1
50 changed files with 82 additions and 2 deletions

16
f.php
View File

@ -241,9 +241,21 @@ header('Content-Type: ' . $link['mime_type']);
if ($cfg['file_hash'] == "md5") {
header('Content-MD5: ' . hex_to_base64($link['hash']));
}
if ($cfg['litespeed_workaround']) {
// Work around that LiteSpeed truncates large files.
// See https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:internal-redirect
if ($_GET['litespeed_workaround'] == 'phase2') {
$file_web_path = preg_replace('#^' . $_SERVER['DOCUMENT_ROOT'] . '#', '', VAR_FILES);
header('X-LiteSpeed-Location: ' . $file_web_path . $p . $link['hash']);
} else {
// Since Content-Type isn't forwarded by LiteSpeed, first
// redirect to the same URL but append the file name.
header('Location: ' . $_SERVER['PHP_SELF'] . '/' . $link['file_name'] . '?' .
$_SERVER['QUERY_STRING'] . '&litespeed_workaround=phase2');
}
}
/* Read encrypted file. */
if ($link['crypted']) {
else if ($link['crypted']) {
/* Init module */
$m = mcrypt_module_open('rijndael-256', '', 'ofb', '');
/* Extract key and iv. */

View File

@ -163,6 +163,19 @@ $cfg['proxy_ip'] = array();
*/
$cfg['file_hash'] = 'md5';
/* Work around that LiteSpeed truncates large files when downloading.
* Only for use with the LiteSpeed web server!
* An internal redirect is made using X-LiteSpeed-Location instead
* of streaming the file from PHP.
* Limitations:
* - The Jirafeau files folder has to be placed under the document root and should be
* protected from unauthorized access using rewrite rules.
* See https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:internal-redirect#protection_from_direct_access
* - Incompatible with server side encryption.
* - Incompatible with one time download.
*/
$cfg['litespeed_workaround'] = false;
/* Required flag to test if the installation is already installed
* or needs to start the installation script
*/

View File

@ -569,6 +569,14 @@ function check_errors($cfg)
if (!is_writable(VAR_ASYNC)) {
add_error(t('ASYNC_DIR_W'), VAR_ASYNC);
}
if ($cfg['enable_crypt'] && $cfg['litespeed_workaround']) {
add_error(t('INCOMPATIBLE_OPTIONS_W'), 'enable_crypt=true<br>litespeed_workaround=true');
}
if ($cfg['one_time_download'] && $cfg['litespeed_workaround']) {
add_error(t('INCOMPATIBLE_OPTIONS_W'), 'one_time_download=true<br>litespeed_workaround=true');
}
}
/**

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "قد لا يدعم متصفحك HTML5، لذا فإن الحد الأقصى لحجم الملف هو ",
"PLURAL_ENDING": "",
"ACCESS_KO": "الدخول محظور",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Ваш браўзер не падтрымлівае HTML5, таму максімальны памер файла ",
"PLURAL_ENDING": "",
"JI_WEB_RE": "Jirafeau — ваша вэб-сховішча файлаў",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "আপনার ব্রাউজার HTML5 সমর্থন নাও করতে পারে, তাই সর্বোচ্চ ফাইলের আকার ",
"PLURAL_ENDING": "",
"ACCESS_KO": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "El teu navegador no és compatible amb HTML5, per tant, la mida màxima del fitxers és ",
"PLURAL_ENDING": "s",
"JI_WEB_RE": "Jirafeau, el teu repositori web de fitxers",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Váš prohlížeč nepodporuje HTML5, proto je maximílní velikost souboru ",
"PLURAL_ENDING": "",
"ACCESS_KO": "Přístup zamítnut",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Ihr Browser unterstützt möglicherweise kein HTML5, demnach beträgt die maximale Dateigröße ",
"PLURAL_ENDING": "n",
"ACCESS_KO": "Zugriff verweigert",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "Χώρος αποθήκευσης των διαδικτυακών σας αρχείων",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "The following configuration options are incompatible:",
"NO_BROWSER_SUPPORT": "Your browser may not support HTML5, so the maximum file size is ",
"PLURAL_ENDING": "s",
"JI_WEB_RE": "Jirafeau, your web file repository",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Tu navegador puede no soportar HTML5, debido a esto el tamaño máximo de archivo es ",
"PLURAL_ENDING": "",
"ACCESS_KO": "Acceso denegado",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "Pääsy estetty",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Votre navigateur ne supporte apparemment pas HTML5, la taille maximale de fichier téléchargable est de ",
"PLURAL_ENDING": "s",
"ACCESS_KO": "Accès interdit",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "Jirafeau , אתר הקבצים שלך",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "Jirafeau, Vaše mrežno skladište datoteka",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "Hozzáférés megtagadva",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Il tuo browser potrebbe non supportare HTML5, quindi la dimensione massima del file è ",
"PLURAL_ENDING": "",
"ACCESS_KO": "Accesso negato",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "Jirafeau, web filibus depositum tuum",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Det kan hende at nettleseren din ikke støtter HTML5, så største tillatte filstørrelse er ",
"PLURAL_ENDING": "er",
"JI_WEB_RE": "Jirafeau, din vevfilpakkebrønn",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "Toegang geweigerd",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "Jirafeau, twoje internetowe repozytorium plików",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,5 +1,6 @@
{
"NO_BROWSER_SUPPORT": "O seu navegador pode não suportar HTML5, então o tamanho máximo do ficheiro é ",
"INCOMPATIBLE_OPTIONS_W": "",
"PLURAL_ENDING": "s",
"ACCESS_KO": "Acesso negado",
"ACTION": "Acção",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Seu navegador pode não suportar HTML5, portanto, o tamanho máximo do arquivo é ",
"PLURAL_ENDING": "s",
"JI_WEB_RE": "Jirafeau, o seu repositório web de arquivos",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "Acces refuzat",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "Доступ запрещён",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Zdá sa, že Váš prehliadač nepodporuje HTML5. Maximálna veľkosť súboru je preto obmedzená na ",
"PLURAL_ENDING": "",
"ACCESS_KO": "Prístup odoprený",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "Приступ одбијен",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "Följande inställningar är inkompatibla:",
"NO_BROWSER_SUPPORT": "Din webbläsare verkar inte stödja HTML5, så max filstorlek är ",
"PLURAL_ENDING": "er",
"JI_WEB_RE": "Jirafeau, ditt filutrymme på nätet",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"JI_WEB_RE": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "Tarayıcınız HTML5'i desteklemeyebilir, bu nedenle en fazla dosya boyutu ",
"PLURAL_ENDING": "sn",
"JI_WEB_RE": "Jirafeau, web dosya deponuz",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "",
"PLURAL_ENDING": "",
"ACCESS_KO": "",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "您的浏览器可能不支持 HTML5因此文件最大为 ",
"PLURAL_ENDING": "s",
"ACCESS_KO": "拒绝访问",

View File

@ -1,4 +1,5 @@
{
"INCOMPATIBLE_OPTIONS_W": "",
"NO_BROWSER_SUPPORT": "您的瀏覽器可能不支持 HTML5因此文件最大為 ",
"PLURAL_ENDING": "s",
"ACCESS_KO": "拒絕訪問",