std: URL paths can contain dashes
This commit is contained in:
parent
74370042aa
commit
d3a9bb1bd4
1 changed files with 9 additions and 1 deletions
|
@ -538,7 +538,7 @@ fn get_path(rawurl: ~str, authority : bool) ->
|
|||
match c {
|
||||
'A' to 'Z' | 'a' to 'z' | '0' to '9' | '&' |'\'' | '(' | ')' | '.'
|
||||
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '='
|
||||
| '_' => {
|
||||
| '_' | '-' => {
|
||||
again;
|
||||
}
|
||||
'?' | '#' => {
|
||||
|
@ -804,6 +804,14 @@ mod tests {
|
|||
assert url.path == ~"/file_name.html";
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_with_dashes() {
|
||||
let urlstr = ~"http://dotcom.com/file-name.html";
|
||||
let url = from_str(urlstr).get();
|
||||
#debug("url: %?", url);
|
||||
assert url.path == ~"/file-name.html";
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_scheme() {
|
||||
assert result::is_err(get_scheme(~"noschemehere.html"));
|
||||
|
|
Loading…
Add table
Reference in a new issue