File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
branches/snap-stage3/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 1
1
---
2
2
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 21187206c3521f10d91627771d682c513a4356dc
4
+ refs/heads/snap-stage3: 8e3105b6db6eb30a95061b56e78581dae0a98996
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
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