File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
branches/dist-snap/src/libstd Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: 21187206c3521f10d91627771d682c513a4356dc
10
+ refs/heads/dist-snap: 8e3105b6db6eb30a95061b56e78581dae0a98996
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -644,6 +644,11 @@ fn to_str(url: url) -> ~str {
644
644
} else {
645
645
~""
646
646
} ;
647
+ let authority = if str:: len ( url. host ) != 0 {
648
+ str:: concat ( ~[ ~"//", user, copy url. host ] )
649
+ } else {
650
+ ~""
651
+ } ;
647
652
let query = if url. query . len ( ) == 0 {
648
653
~""
649
654
} else {
@@ -657,12 +662,11 @@ fn to_str(url: url) -> ~str {
657
662
} ;
658
663
659
664
return str:: concat ( ~[ copy url. scheme ,
660
- ~": //",
661
- user,
662
- copy url. host ,
663
- copy url. path ,
664
- query,
665
- fragment] ) ;
665
+ ~": ",
666
+ authority,
667
+ copy url. path ,
668
+ query,
669
+ fragment] ) ;
666
670
}
667
671
668
672
impl of to_str:: to_str for url {
@@ -849,6 +853,12 @@ mod tests {
849
853
.get().second() == ~" #& +";
850
854
}
851
855
856
+ #[test]
857
+ fn test_url_without_authority() {
858
+ let url = ~" mailto: test@email. com";
859
+ assert to_str ( result:: unwrap ( from_str ( url) ) ) == url;
860
+ }
861
+
852
862
#[ test]
853
863
fn test_encode( ) {
854
864
assert encode ( ~"") == ~"";
You can’t perform that action at this time.
0 commit comments