mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-10 14:36:51 +00:00
[fix-presigned] add comments and reorganize
This commit is contained in:
@@ -15,8 +15,7 @@ use garage_model::garage::Garage;
|
||||
use crate::generic_server::*;
|
||||
use crate::k2v::error::*;
|
||||
|
||||
use crate::signature::payload::check_payload_signature;
|
||||
use crate::signature::streaming::*;
|
||||
use crate::signature::verify_request;
|
||||
|
||||
use crate::helpers::*;
|
||||
use crate::k2v::batch::*;
|
||||
@@ -69,7 +68,7 @@ impl ApiHandler for K2VApiServer {
|
||||
|
||||
async fn handle(
|
||||
&self,
|
||||
mut req: Request<IncomingBody>,
|
||||
req: Request<IncomingBody>,
|
||||
endpoint: K2VApiEndpoint,
|
||||
) -> Result<Response<ResBody>, Error> {
|
||||
let K2VApiEndpoint {
|
||||
@@ -86,18 +85,7 @@ impl ApiHandler for K2VApiServer {
|
||||
return Ok(options_res.map(|_empty_body: EmptyBody| empty_body()));
|
||||
}
|
||||
|
||||
let (api_key, mut content_sha256) =
|
||||
check_payload_signature(&garage, "k2v", &mut req).await?;
|
||||
let api_key = api_key
|
||||
.ok_or_else(|| Error::forbidden("Garage does not support anonymous access yet"))?;
|
||||
|
||||
let req = parse_streaming_body(
|
||||
&api_key,
|
||||
req,
|
||||
&mut content_sha256,
|
||||
&garage.config.s3_api.s3_region,
|
||||
"k2v",
|
||||
)?;
|
||||
let (req, api_key, _content_sha256) = verify_request(&garage, req, "k2v").await?;
|
||||
|
||||
let bucket_id = garage
|
||||
.bucket_helper()
|
||||
|
||||
Reference in New Issue
Block a user