Add HEAD support

This commit is contained in:
2025-08-05 22:56:21 +02:00
parent 518a9b2484
commit dd3a2b03de

View File

@@ -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+");