Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/uri/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ impl Authority {
.expect("static str is not valid authority")
}


/// Attempt to convert a `Bytes` buffer to a `Authority`.
///
/// This will try to prevent a copy if the type passed is the type used
Expand Down Expand Up @@ -91,13 +90,16 @@ impl Authority {
colon_cnt += 1;
}
b'[' => {
start_bracket = true;
if has_percent {
if has_percent || start_bracket {
// Something other than the userinfo has a `%`, so reject it.
return Err(ErrorKind::InvalidAuthority.into());
}
start_bracket = true;
}
b']' => {
if end_bracket {
return Err(ErrorKind::InvalidAuthority.into());
}
end_bracket = true;

// Those were part of an IPv6 hostname, so forget them...
Expand Down