use HTTP_INTERNAL_SERVER_ERROR were appropriate instead of '501'

The http status code 501 is meant to be 'Not Implemented'[0] but that
clearly does not fit here as the default error when we encounter a
problem during handling an api request or upload.

So instead use '500' (HTTP_INTERNAL_SERVER_ERROR) which we already use
in other places where it fits.

0: https://datatracker.ietf.org/doc/html/rfc9110#name-501-not-implemented

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2025-01-28 15:41:25 +01:00 committed by Thomas Lamprecht
parent 9b59e1f033
commit 169d42e0f6

View File

@ -507,7 +507,7 @@ sub send_file_start {
$self->response($reqstate, $resp, $mtime, $nocomp);
};
if (my $err = $@) {
$self->error($reqstate, 501, $err);
$self->error($reqstate, HTTP_INTERNAL_SERVER_ERROR, $err);
}
};
@ -1023,7 +1023,7 @@ sub handle_api2_request {
$self->response($reqstate, $resp, undef, $nocomp, $delay);
};
if (my $err = $@) {
$self->error($reqstate, 501, $err);
$self->error($reqstate, HTTP_INTERNAL_SERVER_ERROR, $err);
}
}
@ -1217,7 +1217,7 @@ sub handle_request {
die "no such file '$path'\n";
};
if (my $err = $@) {
$self->error($reqstate, 501, $err);
$self->error($reqstate, HTTP_INTERNAL_SERVER_ERROR, $err);
}
}
@ -1307,7 +1307,7 @@ sub file_upload_multipart {
};
if (my $err = $@) {
syslog('err', $err);
$self->error($reqstate, 501, $err);
$self->error($reqstate, HTTP_INTERNAL_SERVER_ERROR, $err);
}
}