diff options
| author | bors <bors@rust-lang.org> | 2013-08-09 08:17:04 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-09 08:17:04 -0700 |
| commit | 74efdf6197aaee39bd14f8d97b75dbba08f1d32e (patch) | |
| tree | fb109deb3d08787509249678443a6588f950ff55 /src/libstd/rt | |
| parent | 6928a10e3f606c3e9e8b94947489244f0e542876 (diff) | |
| parent | ae81151ad63e2db7ec893f90a4e99592cabb6b30 (diff) | |
| download | rust-74efdf6197aaee39bd14f8d97b75dbba08f1d32e.tar.gz rust-74efdf6197aaee39bd14f8d97b75dbba08f1d32e.zip | |
auto merge of #8352 : stepancheg/rust/ipv6-to-str, r=luqmana
Reported by @luqmana
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/io/net/ip.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstd/rt/io/net/ip.rs b/src/libstd/rt/io/net/ip.rs index 81269d197d5..77176088801 100644 --- a/src/libstd/rt/io/net/ip.rs +++ b/src/libstd/rt/io/net/ip.rs @@ -43,7 +43,7 @@ impl ToStr for IpAddr { } // Ipv4-Mapped address - Ipv6Addr(0, 0, 0, 0, 0, 1, g, h) => { + Ipv6Addr(0, 0, 0, 0, 0, 0xFFFF, g, h) => { let a = fmt!("%04x", g as uint); let b = FromStrRadix::from_str_radix(a.slice(2, 4), 16).unwrap(); let a = FromStrRadix::from_str_radix(a.slice(0, 2), 16).unwrap(); @@ -437,4 +437,11 @@ mod test { // port out of range assert_eq!(None, FromStr::from_str::<SocketAddr>("127.0.0.1:123456")); } + + #[test] + fn ipv6_addr_to_str() { + let a1 = Ipv6Addr(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x280); + assert!(a1.to_str() == ~"::ffff:192.0.2.128" || a1.to_str() == ~"::FFFF:192.0.2.128"); + } + } |
