aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/web/web_server.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/web/web_server.rs b/src/web/web_server.rs
index 73aa6648..2440857d 100644
--- a/src/web/web_server.rs
+++ b/src/web/web_server.rs
@@ -93,6 +93,12 @@ fn authority_to_host(authority: &str) -> Result<&str, Error> {
}
}
+/// 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".
+/// This behavior has been chosen to follow AWS S3 semantic.
fn host_to_bucket<'a>(host: &'a str, root: &str) -> &'a str {
if root.len() >= host.len() || !host.ends_with(root) {
return host;