mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
std: Parse underscores in url paths
This commit is contained in:
parent
03330baf9c
commit
1e3143b34e
@ -537,7 +537,8 @@ fn get_path(rawurl: ~str, authority : bool) ->
|
||||
for str::each_chari(rawurl) |i,c| {
|
||||
match c {
|
||||
'A' to 'Z' | 'a' to 'z' | '0' to '9' | '&' |'\'' | '(' | ')' | '.'
|
||||
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '=' => {
|
||||
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '='
|
||||
| '_' => {
|
||||
again;
|
||||
}
|
||||
'?' | '#' => {
|
||||
@ -795,6 +796,14 @@ mod tests {
|
||||
assert url.path == ~"/";
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_with_underscores() {
|
||||
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…
Reference in New Issue
Block a user