Skip to content

Commit 03ec409

Browse files
committed
Do not set host if url cannot be a base.
1 parent ae8b86a commit 03ec409

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/quirks.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ pub fn set_host(url: &mut Url, new_host: &str) -> Result<(), ()> {
102102
let host;
103103
let opt_port;
104104
{
105+
// If context object’s url’s cannot-be-a-base-URL flag is set, then return.
106+
if url.cannot_be_a_base() {
107+
return Err(());
108+
}
109+
105110
let scheme = url.scheme();
106111
let result = Parser::parse_host(Input::new(new_host), SchemeType::from(scheme));
107112
match result {

0 commit comments

Comments
 (0)