diff options
author | Quentin <quentin@deuxfleurs.fr> | 2020-11-10 17:05:10 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2020-11-10 17:05:10 +0100 |
commit | 3cb3994cd2005231f8cc60ce02c55762a7b293f3 (patch) | |
tree | b21f9b922f94de7bc31301f223e61aedab40187b | |
parent | cacf8ddf2da9c80574647aeb0d61dd15f9f8c5d5 (diff) | |
download | garage-3cb3994cd2005231f8cc60ce02c55762a7b293f3.tar.gz garage-3cb3994cd2005231f8cc60ce02c55762a7b293f3.zip |
Add documentation to host_to_bucket
-rw-r--r-- | src/web/web_server.rs | 6 |
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; |