Skip to content

Commit

Permalink
mysten-network: default to http if not present
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Jul 5, 2024
1 parent 3662fcc commit 4ec65b4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions crates/mysten-network/src/multiaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,10 @@ pub(crate) fn parse_tcp<'a, T: Iterator<Item = Protocol<'a>>>(protocols: &mut T)
pub(crate) fn parse_http_https<'a, T: Iterator<Item = Protocol<'a>>>(
protocols: &mut T,
) -> Result<&'static str> {
match protocols
.next()
.ok_or_else(|| eyre!("unexpected end of multiaddr"))?
{
Protocol::Http => Ok("http"),
Protocol::Https => Ok("https"),
_ => Err(eyre!("expected http/https protocol")),
match protocols.next() {
Some(Protocol::Http) => Ok("http"),
Some(Protocol::Https) => Ok("https"),
_ => Ok("http"),
}
}

Expand Down

0 comments on commit 4ec65b4

Please sign in to comment.