std: URLs without schemes parse as errors. Closes #3112
This commit is contained in:
parent
a52f6d26db
commit
dbf58716df
1 changed files with 6 additions and 1 deletions
|
|
@ -353,7 +353,7 @@ fn get_scheme(rawurl: ~str) -> result::result<(~str, ~str), @~str> {
|
|||
}
|
||||
}
|
||||
};
|
||||
return result::ok((copy rawurl, ~""));
|
||||
return result::err(@~"url: Scheme must be terminated with a colon.");
|
||||
}
|
||||
|
||||
// returns userinfo, host, port, and unparsed part, or an error
|
||||
|
|
@ -779,6 +779,11 @@ mod tests {
|
|||
assert option::unwrap(copy u.fragment) == ~"something";
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_scheme() {
|
||||
assert result::is_err(get_scheme(~"noschemehere.html"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_scheme_errors() {
|
||||
assert result::is_err(from_str(~"99://something"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue