Skip to content

Commit 0b07c82

Browse files
committed
Propagate the correct has_host value when parsing a file hostname
1 parent 5a8ed2c commit 0b07c82

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/parser.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,14 +1043,20 @@ impl<'a> Parser<'a> {
10431043
&mut self,
10441044
input: Input<'i>,
10451045
) -> ParseResult<(bool, HostInternal, Input<'i>)> {
1046-
let (has_host, host_str, remaining) = Parser::file_host(input)?;
1046+
let has_host;
1047+
let (_, host_str, remaining) = Parser::file_host(input)?;
10471048
let host = if host_str.is_empty() {
1049+
has_host = false;
10481050
HostInternal::None
10491051
} else {
10501052
match Host::parse(&host_str)? {
1051-
Host::Domain(ref d) if d == "localhost" => HostInternal::None,
1053+
Host::Domain(ref d) if d == "localhost" => {
1054+
has_host = false;
1055+
HostInternal::None
1056+
}
10521057
host => {
10531058
write!(&mut self.serialization, "{}", host).unwrap();
1059+
has_host = true;
10541060
host.into()
10551061
}
10561062
}

0 commit comments

Comments
 (0)