std: URL paths can contain dashes

This commit is contained in:
Brian Anderson 2012-08-06 15:17:08 -07:00
parent 74370042aa
commit d3a9bb1bd4

View file

@ -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"));