Skip to content

Commit 4b7853b

Browse files
committed
Support X-HTTP-Method-Override
1 parent 2c5c3e4 commit 4b7853b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

restic-index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ function route($method, $path, $fn) {
4141
$user = $_SERVER["HTTP_AUTHORIZATION"];
4242
}
4343

44-
if ($_SERVER["REQUEST_METHOD"] == $method && $apply == 1) {
44+
$req_method = array_key_exists("HTTP_X_HTTP_METHOD_OVERRIDE", $_SERVER)
45+
? strtoupper($_SERVER["HTTP_X_HTTP_METHOD_OVERRIDE"])
46+
: strtoupper($_SERVER["REQUEST_METHOD"]);
47+
if ($req_method == $method && $apply == 1) {
4548
if ($restic->private_repos && $user !== $first) {
4649
$restic->sendStatus(401); //Unauthorized
4750
header("Content-Type:");

0 commit comments

Comments
 (0)