fix websockets

This commit is contained in:
John Smith
2022-01-05 16:58:18 -05:00
parent b66aca0ce0
commit ea2300c32b
5 changed files with 24 additions and 23 deletions

View File

@@ -461,18 +461,18 @@ impl FromStr for DialInfo {
Ok(DialInfo::tcp(socket_address))
}
"ws" => {
let (sa, rest) = s.split_once('|').ok_or_else(|| {
let (sa, rest) = rest.split_once('|').ok_or_else(|| {
parse_error!("DialInfo::from_str missing socket address '|' separator", s)
})?;
let socket_address = SocketAddress::from_str(sa)?;
DialInfo::try_ws(socket_address, rest.to_string())
DialInfo::try_ws(socket_address, format!("ws://{}", rest))
}
"wss" => {
let (sa, rest) = s.split_once('|').ok_or_else(|| {
let (sa, rest) = rest.split_once('|').ok_or_else(|| {
parse_error!("DialInfo::from_str missing socket address '|' separator", s)
})?;
let socket_address = SocketAddress::from_str(sa)?;
DialInfo::try_wss(socket_address, rest.to_string())
DialInfo::try_wss(socket_address, format!("wss://{}", rest))
}
_ => Err(parse_error!("DialInfo::from_str has invalid scheme", s)),
}