about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/kgio/connect.c2
-rw-r--r--test/test_tcp_connect.rb2
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