rest-server: use BAD_REQUEST for non-GET on file-paths

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2023-01-24 11:31:07 +01:00
parent 93c027f5cc
commit a1119a3e63

View File

@ -21,11 +21,11 @@ use tokio::time::Instant;
use tower_service::Service; use tower_service::Service;
use url::form_urlencoded; use url::form_urlencoded;
use proxmox_router::http_err;
use proxmox_router::{ use proxmox_router::{
check_api_permission, ApiHandler, ApiMethod, HttpError, Permission, RpcEnvironment, check_api_permission, ApiHandler, ApiMethod, HttpError, Permission, RpcEnvironment,
RpcEnvironmentType, UserInformation, RpcEnvironmentType, UserInformation,
}; };
use proxmox_router::{http_bail, http_err};
use proxmox_schema::{ObjectSchemaType, ParameterSchema}; use proxmox_schema::{ObjectSchemaType, ParameterSchema};
use proxmox_async::stream::AsyncReaderStream; use proxmox_async::stream::AsyncReaderStream;
@ -727,7 +727,7 @@ impl ApiConfig {
// not Auth required for accessing files! // not Auth required for accessing files!
if method != hyper::Method::GET { if method != hyper::Method::GET {
bail!("Unsupported HTTP method {}", method); http_bail!(BAD_REQUEST, "invalid http method for path");
} }
if comp_len == 0 { if comp_len == 0 {