From 0a478b4ac64f5e656a455916ad26a171951ecbf4 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Thu, 7 Nov 2013 16:16:15 -0500 Subject: [PATCH] Add ~ to the list of allowable URL characters. --- src/libextra/url.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libextra/url.rs b/src/libextra/url.rs index d268b106e5c..8005acf6e6b 100644 --- a/src/libextra/url.rs +++ b/src/libextra/url.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -581,7 +581,7 @@ fn get_path(rawurl: &str, authority: bool) -> match c { 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.' | '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '=' - | '_' | '-' => { + | '_' | '-' | '~' => { continue; } '?' | '#' => { @@ -824,7 +824,7 @@ mod tests { #[test] fn test_url_parse() { - let url = ~"http://user:pass@rust-lang.org:8080/doc?s=v#something"; + let url = ~"http://user:pass@rust-lang.org:8080/doc/~u?s=v#something"; let up = from_str(url); let u = up.unwrap(); @@ -832,7 +832,7 @@ mod tests { assert_eq!(&u.user, &Some(UserInfo::new(~"user", Some(~"pass")))); assert_eq!(&u.host, &~"rust-lang.org"); assert_eq!(&u.port, &Some(~"8080")); - assert_eq!(&u.path, &~"/doc"); + assert_eq!(&u.path, &~"/doc/~u"); assert_eq!(&u.query, &~[(~"s", ~"v")]); assert_eq!(&u.fragment, &Some(~"something")); }