Skip to content

Commit 8977a05

Browse files
Daniel Pattersonbrson
authored andcommitted
---
yaml --- r: 20851 b: refs/heads/snap-stage3 c: 8e3105b h: refs/heads/master i: 20849: ba72b38 20847: 8079c71 v: v3
1 parent a4bf07d commit 8977a05

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 21187206c3521f10d91627771d682c513a4356dc
4+
refs/heads/snap-stage3: 8e3105b6db6eb30a95061b56e78581dae0a98996
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/net_url.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,11 @@ fn to_str(url: url) -> ~str {
644644
} else {
645645
~""
646646
};
647+
let authority = if str::len(url.host) != 0 {
648+
str::concat(~[~"//", user, copy url.host])
649+
} else {
650+
~""
651+
};
647652
let query = if url.query.len() == 0 {
648653
~""
649654
} else {
@@ -657,12 +662,11 @@ fn to_str(url: url) -> ~str {
657662
};
658663

659664
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]);
666670
}
667671

668672
impl of to_str::to_str for url {
@@ -849,6 +853,12 @@ mod tests {
849853
.get().second() == ~"#&+";
850854
}
851855
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+
852862
#[test]
853863
fn test_encode() {
854864
assert encode(~"") == ~"";

0 commit comments

Comments
 (0)