aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-01-16 12:12:27 +0100
committerAlex Auvolat <alex@adnab.me>2024-01-16 12:12:27 +0100
commit4c5be79b8015510618ad1df7451c50e3f2659978 (patch)
tree09f2dbdd30f8464c2d1f27532a690a46258aedb9 /src/api/s3
parentd91a1de7315373271bce72088a4c73007f2154e8 (diff)
parent083e982f5fd0e88e496da7d67734abd8927f3f98 (diff)
downloadgarage-4c5be79b8015510618ad1df7451c50e3f2659978.tar.gz
garage-4c5be79b8015510618ad1df7451c50e3f2659978.zip
Merge tag 'v0.8.5' into sync-08-09
Garage v0.8.5 This minor release includes the following improvements and fixes: New features: - Configuration: make LMDB's `map_size` configurable and make `block_size` and `sled_cache_capacity` expressable as strings (such as `10M`) (#628, #630) - Add support for binding to Unix sockets for the S3, K2V, Admin and Web API servers (#640) - Move the `convert_db` command into the main Garage binary (#645) - Add support for specifying RPC secret and admin tokens as environment variables (#643) - Add `allow_world_readable_secrets` option to config file (#663, #685) Bug fixes: - Use `statvfs` instead of mount list to determine free space in metadata/data directories (#611, #631) - Add missing casts to fix 32-bit build (#632) - Fix error when none of the HTTP servers (S3/K2V/Admin/Web) is started and fix shutdown hang (#613, #633) - Add missing CORS headers to PostObject response (#609, #656) - Monitoring: finer histogram boundaries in Prometheus exported metrics (#531, #686) Other: - Documentation improvements (#641)
Diffstat (limited to 'src/api/s3')
-rw-r--r--src/api/s3/post_object.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/api/s3/post_object.rs b/src/api/s3/post_object.rs
index 542b7a81..f9eccb7f 100644
--- a/src/api/s3/post_object.rs
+++ b/src/api/s3/post_object.rs
@@ -15,6 +15,7 @@ use serde::Deserialize;
use garage_model::garage::Garage;
+use crate::s3::cors::*;
use crate::s3::error::*;
use crate::s3::put::{get_headers, save_stream};
use crate::s3::xml as s3_xml;
@@ -242,7 +243,7 @@ pub async fn handle_post_object(
let etag = format!("\"{}\"", md5);
- let resp = if let Some(mut target) = params
+ let mut resp = if let Some(mut target) = params
.get("success_action_redirect")
.and_then(|h| h.to_str().ok())
.and_then(|u| url::Url::parse(u).ok())
@@ -262,8 +263,7 @@ pub async fn handle_post_object(
} else {
let path = head
.uri
- .into_parts()
- .path_and_query
+ .path_and_query()
.map(|paq| paq.path().to_string())
.unwrap_or_else(|| "/".to_string());
let authority = head
@@ -308,6 +308,13 @@ pub async fn handle_post_object(
}
};
+ let matching_cors_rule =
+ find_matching_cors_rule(&bucket, &Request::from_parts(head, Body::empty()))?;
+ if let Some(rule) = matching_cors_rule {
+ add_cors_headers(&mut resp, rule)
+ .ok_or_internal_error("Invalid bucket CORS configuration")?;
+ }
+
Ok(resp)
}