split server hostname and port using the last :
This commit is contained in:
parent
3ef16eb5db
commit
f51b2741d3
@ -245,16 +245,16 @@ pub fn deserialize_server<'de, D>(deserializer: D) -> Result<(String, u16), D::E
|
|||||||
where
|
where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let s = String::deserialize(deserializer)?;
|
let mut s = String::deserialize(deserializer)?;
|
||||||
let mut parts = s.split(':');
|
|
||||||
|
|
||||||
match (parts.next(), parts.next(), parts.next()) {
|
let (domain, port) = s
|
||||||
(Some(domain), Some(port), None) => port.parse().map_or_else(
|
.rsplit_once(':')
|
||||||
|e| Err(DeError::custom(e)),
|
.ok_or(DeError::custom("invalid server address"))?;
|
||||||
|port| Ok((domain.to_owned(), port)),
|
|
||||||
),
|
let port = port.parse().map_err(DeError::custom)?;
|
||||||
_ => Err(DeError::custom("invalid server address")),
|
s.truncate(domain.len());
|
||||||
}
|
|
||||||
|
Ok((s, port))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deserialize_password<'de, D>(deserializer: D) -> Result<Arc<[u8]>, D::Error>
|
pub fn deserialize_password<'de, D>(deserializer: D) -> Result<Arc<[u8]>, D::Error>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user