summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-14 10:04:35 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-14 10:04:35 +0000
commitcd4d74e9bec14e97d4df2ed5cec8b3149a1f79ef (patch)
tree762f5da440a2026f5dd80d752604b00c1920c9c9
parentd2e6f552f3f0e19729c501fa30bb9198153d4a65 (diff)
* ext/socket/socket.c (Init_socket): IPv6 is not supported although
AF_INET6 is defined on MinGW. * lib/ipaddr.rb (AF_INET6): workaround in the environment which does not support IPv6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ext/socket/socket.c4
-rw-r--r--lib/ipaddr.rb12
3 files changed, 22 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c655dacd9e..136220cc9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sun Dec 14 18:46:48 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/socket.c (Init_socket): IPv6 is not supported although
+ AF_INET6 is defined on MinGW.
+
+ * lib/ipaddr.rb (AF_INET6): workaround in the environment which does
+ not support IPv6.
+
Sat Dec 13 18:55:16 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/iconv/charset_alias.rb: preserve original order.
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index e842603067..8a1825d795 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -2511,10 +2511,10 @@ Init_socket()
sock_define_const("AF_UNSPEC", AF_UNSPEC);
sock_define_const("PF_UNSPEC", PF_UNSPEC);
#endif
-#ifdef AF_INET6
+#ifdef INET6
sock_define_const("AF_INET6", AF_INET6);
#endif
-#ifdef PF_INET6
+#ifdef INET6
sock_define_const("PF_INET6", PF_INET6);
#endif
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb
index b8befe8499..79ea0d6245 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -32,6 +32,18 @@
require 'socket'
+unless Socket.const_defined? "AF_INET6"
+ class Socket
+ AF_INET6 = Object.new
+ end
+ class << IPSocket
+ alias getaddress_orig getaddress
+ def getaddress(s)
+ /^::/ =~ s ? s : getaddress_orig(s)
+ end
+ end
+end
+
# IPAddr provides a set of methods to manipulate an IP address. Both
# IPv4 and IPv6 are supported.
class IPAddr