aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_router.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-02-28 11:15:53 +0100
committerAlex Auvolat <alex@adnab.me>2022-02-28 12:22:39 +0100
commit8129a9829165c8543b2ab2d32e8f20ed54ced9e5 (patch)
tree5a1eae4279761a82722dc1224b1261a72aba96da /src/api/s3_router.rs
parent54e02b4c3ba466988c50984aba9b60dc51b6cdce (diff)
downloadgarage-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.rs9
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 {