From dd3a2b03de5abef2d41e6aa4b977d6afb45c73e3 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Tue, 5 Aug 2025 22:56:21 +0200 Subject: [PATCH] Add HEAD support --- www/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/index.php b/www/index.php index 12195fc..bf58256 100644 --- a/www/index.php +++ b/www/index.php @@ -200,7 +200,7 @@ foreach ($clients as $c) { header('Status: 400'); header('Content-Length: 16'); exit("400 Bad Request\n"); - } else if ($_SERVER['REQUEST_METHOD'] === 'GET') { + } else if ($_SERVER['REQUEST_METHOD'] === 'GET' || $_SERVER['REQUEST_METHOD'] === 'HEAD') { $size = filesize($path); if ($size === false) { header('Status: 404'); @@ -211,7 +211,8 @@ foreach ($clients as $c) { header("Content-Type: $type"); header("Content-Disposition: attachment; filename=\"$file\""); header("Content-Length: $size"); - readfile($path); + if ($_SERVER['REQUEST_METHOD'] !== 'HEAD') + readfile($path); } else if ($_SERVER['REQUEST_METHOD'] === 'PUT') { $upload = fopen("php://input", "r"); $fp = fopen("/tmp/upload-$file", "wb+");