Add HEAD support
This commit is contained in:
@@ -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,6 +211,7 @@ foreach ($clients as $c) {
|
||||
header("Content-Type: $type");
|
||||
header("Content-Disposition: attachment; filename=\"$file\"");
|
||||
header("Content-Length: $size");
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'HEAD')
|
||||
readfile($path);
|
||||
} else if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
|
||||
$upload = fopen("php://input", "r");
|
||||
|
Reference in New Issue
Block a user