forked from Deuxfleurs/garage
Support punnycode
This commit is contained in:
parent
2e94275e68
commit
5b363626f4
3 changed files with 5 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -661,6 +661,7 @@ dependencies = [
|
|||
"hex",
|
||||
"http",
|
||||
"hyper",
|
||||
"idna",
|
||||
"log",
|
||||
"percent-encoding",
|
||||
"rand",
|
||||
|
|
|
@ -41,4 +41,4 @@ rustls = "0.17"
|
|||
webpki = "0.21"
|
||||
|
||||
roxmltree = "0.11"
|
||||
|
||||
idna = "0.2"
|
||||
|
|
|
@ -10,6 +10,8 @@ use hyper::server::conn::AddrStream;
|
|||
use hyper::service::{make_service_fn, service_fn};
|
||||
use hyper::{Body, Request, Response, Server};
|
||||
|
||||
use idna::domain_to_unicode;
|
||||
|
||||
use garage_model::garage::Garage;
|
||||
use garage_util::error::Error as GarageError;
|
||||
use crate::error::*;
|
||||
|
@ -70,7 +72,7 @@ async fn serve_file(garage: Arc<Garage>, req: Request<Body>) -> Result<Response<
|
|||
.to_str()?;
|
||||
|
||||
// Get bucket
|
||||
let host = authority_to_host(authority)?;
|
||||
let (host, _) = domain_to_unicode(authority_to_host(authority)?);
|
||||
let root = &garage.config.s3_web.root_domain;
|
||||
let bucket = host_to_bucket(&host, root);
|
||||
|
||||
|
|
Loading…
Reference in a new issue