Skip to content

Commit

Permalink
Socket.getaddrinfo may return a long IPv6 address without compressing…
Browse files Browse the repository at this point in the history
… zeros.
  • Loading branch information
BanzaiMan committed Jul 25, 2010
1 parent a599e55 commit 8cb265e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions library/socket/socket/getaddrinfo_spec.rb
Expand Up @@ -89,8 +89,11 @@
Socket::IPPROTO_TCP,
Socket::AI_PASSIVE)

expected = [["AF_INET6", 80, "::", "::", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP]]
res.should == expected
expected = [
["AF_INET6", 80, "::", "::", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP],
["AF_INET6", 80, "0:0:0:0:0:0:0:0", "0:0:0:0:0:0:0:0", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP]
]
res.each { |a| expected.should include (a) }
end

it "accepts empty addresses for IPv6 non-passive sockets" do
Expand All @@ -101,8 +104,11 @@
Socket::IPPROTO_TCP,
0)

expected = [["AF_INET6", 80, "::1", "::1", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP]]
res.should == expected
expected = [
["AF_INET6", 80, "::1", "::1", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP],
["AF_INET6", 80, "0:0:0:0:0:0:0:1", "0:0:0:0:0:0:0:1", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP]
]
res.each { |a| expected.should include (a) }
end
end

0 comments on commit 8cb265e

Please sign in to comment.