diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-13 16:33:29 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-13 16:36:58 -0800 |
commit | b30aa658d7b4d946427119b23cfc264cc7172149 (patch) | |
tree | e0c09a6f984c2f2cc494142649a2378cd598a9e7 | |
parent | f74bcf37ed31611d14aba2d4b4518c6a3dea0f40 (diff) | |
download | kgio-b30aa658d7b4d946427119b23cfc264cc7172149.tar.gz |
It's not needed since we already verify the service is a numeric port. AI_NUMERICSERV is not available in older glibc (<2.3.4) and probably other old systems.
-rw-r--r-- | ext/kgio/connect.c | 2 | ||||
-rw-r--r-- | test/test_tcp_connect.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/ext/kgio/connect.c b/ext/kgio/connect.c index 1545853..8a91ea2 100644 --- a/ext/kgio/connect.c +++ b/ext/kgio/connect.c @@ -73,7 +73,7 @@ static VALUE tcp_connect(VALUE klass, VALUE ip, VALUE port, int io_wait) hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; /* disallow non-deterministic DNS lookups */ - hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV; + hints.ai_flags = AI_NUMERICHOST; rc = getaddrinfo(ipname, ipport, &hints, &res); if (rc != 0) diff --git a/test/test_tcp_connect.rb b/test/test_tcp_connect.rb index 194a630..4fb4070 100644 --- a/test/test_tcp_connect.rb +++ b/test/test_tcp_connect.rb @@ -44,6 +44,8 @@ class TestKgioTcpConnect < Test::Unit::TestCase def test_tcp_socket_new_invalid assert_raises(ArgumentError) { Kgio::TCPSocket.new('example.com', 80) } assert_raises(ArgumentError) { Kgio::TCPSocket.new('999.999.999.999', 80) } + assert_raises(TypeError) { Kgio::TCPSocket.new("127.0.0.1", "http") } + assert_raises(TypeError) { Kgio::TCPSocket.new('example.com', "http") } end def test_tcp_socket_new |