From a1119a3e6368a6625cecbc4959c65e2dbe7ef640 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 24 Jan 2023 11:31:07 +0100 Subject: [PATCH] rest-server: use BAD_REQUEST for non-GET on file-paths Signed-off-by: Wolfgang Bumiller --- proxmox-rest-server/src/rest.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxmox-rest-server/src/rest.rs b/proxmox-rest-server/src/rest.rs index 9fcb9db0..7a31857b 100644 --- a/proxmox-rest-server/src/rest.rs +++ b/proxmox-rest-server/src/rest.rs @@ -21,11 +21,11 @@ use tokio::time::Instant; use tower_service::Service; use url::form_urlencoded; -use proxmox_router::http_err; use proxmox_router::{ check_api_permission, ApiHandler, ApiMethod, HttpError, Permission, RpcEnvironment, RpcEnvironmentType, UserInformation, }; +use proxmox_router::{http_bail, http_err}; use proxmox_schema::{ObjectSchemaType, ParameterSchema}; use proxmox_async::stream::AsyncReaderStream; @@ -727,7 +727,7 @@ impl ApiConfig { // not Auth required for accessing files! if method != hyper::Method::GET { - bail!("Unsupported HTTP method {}", method); + http_bail!(BAD_REQUEST, "invalid http method for path"); } if comp_len == 0 {