-
-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Labels
breakingRequires breaking backwards compatibilityRequires breaking backwards compatibility
Description
isahc's reliance on http::Uri makes it cumbersome to work with URLs which have hostnames with non-ASCII characters.
I suggest that isahc switch to using url::Url instead of http::Uri.
Motivations:
- In 2022, it should be straight forward to work with URLs which are international.
- Also, sematically, I claim it is more clear for an HTTP client to work with URLs rather than URIs. It's hard to imagine isahc being used with non-URL URIs.
The following code shows the current state of affairs in some crates:
/*
In Carto.toml:
[dependencies]
url = "2"
http = "0.2"
reqwest = "0.11"
*/
fn main() -> Result<(), Box<dyn std::error::Error>> {
let url_str = "https://www.fc-højvang.dk/";
// Crate: url
let url = url::Url::parse(url_str)?; //
println!("url: {}", url); // Prints URL with IDNA
// Crate: reqwest
let reqwest_url = reqwest::Url::parse(url_str)?;//
println!("reqwest_uri: {}", reqwest_url); // Prints URL with IDNA
// Crate: http
let http_uri = url_str.parse::<http::Uri>()?; //
println!("http_uri: {}", http_uri); // FAILS
/*
Error message:
InvalidUri(InvalidUriChar)
*/
Ok(())
}
Metadata
Metadata
Assignees
Labels
breakingRequires breaking backwards compatibilityRequires breaking backwards compatibility