Skip to content

Commit e2e8b94

Browse files
committed
Support IPv6 URIs with rustls
1 parent 8803232 commit e2e8b94

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,9 @@ where
373373
#[inline]
374374
fn domain(request: &tungstenite::handshake::client::Request) -> Result<String, WsError> {
375375
match request.uri().host() {
376+
// rustls expects IPv6 addresses without the surrounding [] brackets
377+
#[cfg(feature = "__rustls-tls")]
378+
Some(d) if d.starts_with('[') && d.ends_with(']') => Ok(d[1..d.len() - 1].to_string()),
376379
Some(d) => Ok(d.to_string()),
377380
None => Err(WsError::Url(tungstenite::error::UrlError::NoHostName)),
378381
}

0 commit comments

Comments
 (0)