Skip to content

Commit d59737f

Browse files
Daniel Pattersonbrson
authored andcommitted
---
yaml --- r: 31621 b: refs/heads/dist-snap c: 8e3105b h: refs/heads/master i: 31619: d45bae6 v: v3
1 parent 756ef29 commit d59737f

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
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 21187206c3521f10d91627771d682c513a4356dc
10+
refs/heads/dist-snap: 8e3105b6db6eb30a95061b56e78581dae0a98996
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/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)