Fix same-host JMAP redirection on non-standard ports (#2271)
Fixes #2221
This commit is contained in:
@@ -239,13 +239,11 @@ pub async fn name_to_id(client: &Client, name: &str) -> String {
|
|||||||
pub fn host(url: &str) -> Option<&str> {
|
pub fn host(url: &str) -> Option<&str> {
|
||||||
url.split_once("://")
|
url.split_once("://")
|
||||||
.map(|(_, url)| url.split_once('/').map_or(url, |(host, _)| host))
|
.map(|(_, url)| url.split_once('/').map_or(url, |(host, _)| host))
|
||||||
|
.map(|host| host.rsplit_once(':').map_or(host, |(host, _)| host))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_localhost(url: &str) -> bool {
|
pub fn is_localhost(url: &str) -> bool {
|
||||||
host(url).is_some_and(|host| {
|
host(url).is_some_and(|host| host == "localhost" || host == "127.0.0.1" || host == "[::1]")
|
||||||
let host = host.rsplit_once(':').map_or(host, |(host, _)| host);
|
|
||||||
host == "localhost" || host == "127.0.0.1" || host == "[::1]"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait OAuthResponse {
|
pub trait OAuthResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user