Skip to content

Commit 86607f8

Browse files
committed
Do not try to set port if empty string.
1 parent 3d644a5 commit 86607f8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/quirks.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,13 @@ pub fn set_host(url: &mut Url, new_host: &str) -> Result<(), ()> {
111111
Ok((h, remaining)) => {
112112
host = h;
113113
opt_port = if let Some(remaining) = remaining.split_prefix(':') {
114-
Parser::parse_port(remaining, || default_port(scheme), Context::Setter)
115-
.ok()
116-
.map(|(port, _remaining)| port)
114+
if remaining.is_empty() {
115+
None
116+
} else {
117+
Parser::parse_port(remaining, || default_port(scheme), Context::Setter)
118+
.ok()
119+
.map(|(port, _remaining)| port)
120+
}
117121
} else {
118122
None
119123
};

0 commit comments

Comments
 (0)