mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-18 09:23:13 +00:00
update doc and comments
This commit is contained in:
@@ -263,7 +263,8 @@ async fn handler_inner(garage: Arc<Garage>, req: Request<Body>) -> Result<Respon
|
||||
}
|
||||
}
|
||||
|
||||
/// Extract the bucket name and the key name from an HTTP path and possibly Host header
|
||||
/// Extract the bucket name and the key name from an HTTP path and possibly a bucket provided in
|
||||
/// the host header of the request
|
||||
///
|
||||
/// S3 internally manages only buckets and keys. This function splits
|
||||
/// an HTTP path to get the corresponding bucket name and key.
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@ use idna::domain_to_unicode;
|
||||
|
||||
/// Host to bucket
|
||||
///
|
||||
/// Convert a host, like "bucket.garage-site.tld" or "john.doe.com"
|
||||
/// to the corresponding bucket, resp. "bucket" and "john.doe.com"
|
||||
/// considering that ".garage-site.tld" is the "root domain".
|
||||
/// Convert a host, like "bucket.garage-site.tld" to the corresponding bucket "bucket",
|
||||
/// considering that ".garage-site.tld" is the "root domain". For domains not matching
|
||||
/// the provided root domain, no bucket is returned
|
||||
/// This behavior has been chosen to follow AWS S3 semantic.
|
||||
pub fn host_to_bucket<'a>(host: &'a str, root: &str) -> Option<&'a str> {
|
||||
let root = root.trim_start_matches('.');
|
||||
|
||||
Reference in New Issue
Block a user