diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-28 11:15:53 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-02-28 12:22:39 +0100 |
commit | 8129a9829165c8543b2ab2d32e8f20ed54ced9e5 (patch) | |
tree | 5a1eae4279761a82722dc1224b1261a72aba96da /src/api/s3_router.rs | |
parent | 54e02b4c3ba466988c50984aba9b60dc51b6cdce (diff) | |
download | garage-8129a9829165c8543b2ab2d32e8f20ed54ced9e5.tar.gz garage-8129a9829165c8543b2ab2d32e8f20ed54ced9e5.zip |
Process CORS earlier in pipeline
Diffstat (limited to 'src/api/s3_router.rs')
-rw-r--r-- | src/api/s3_router.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/api/s3_router.rs b/src/api/s3_router.rs index 2a68d79e..95a7eceb 100644 --- a/src/api/s3_router.rs +++ b/src/api/s3_router.rs @@ -414,8 +414,7 @@ pub enum Endpoint { // It's intended to be used with HTML forms, using a multipart/form-data body. // It works a lot like presigned requests, but everything is in the form instead // of being query parameters of the URL, so authenticating it is a bit different. - PostObject { - }, + PostObject, }} impl Endpoint { @@ -430,7 +429,11 @@ impl Endpoint { let path = uri.path().trim_start_matches('/'); let query = uri.query(); if bucket.is_none() && path.is_empty() { - return Ok((Self::ListBuckets, None)); + if *req.method() == Method::OPTIONS { + return Ok((Self::Options, None)); + } else { + return Ok((Self::ListBuckets, None)); + } } let (bucket, key) = if let Some(bucket) = bucket { |