diff options
author | Masaki Matsushita <glass.saga@gmail.com> | 2020-08-29 17:18:59 +0900 |
---|---|---|
committer | Masaki Matsushita <glass.saga@gmail.com> | 2020-08-29 17:18:59 +0900 |
commit | 6d946665bd79a93fb98b2d25400d1b6174472302 (patch) | |
tree | cd6c512d1d3e5f5172ad5caae613407560ae431e | |
parent | 56dd578d7e715fd255c668577162ede65c7e909f (diff) | |
download | ruby-6d946665bd79a93fb98b2d25400d1b6174472302.tar.gz |
Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddr
-rw-r--r-- | ext/socket/socket.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index edf5f00626..dc6588f82f 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -965,6 +965,7 @@ sock_sockaddr(struct sockaddr *addr, socklen_t len) static VALUE sock_s_gethostbyname(VALUE obj, VALUE host) { + rb_warn("Socket.gethostbyname is deprecated; use Addrinfo.getaddrinfo instead."); struct rb_addrinfo *res = rsock_addrinfo(host, Qnil, AF_UNSPEC, SOCK_STREAM, AI_CANONNAME); return rsock_make_hostent(host, res, sock_sockaddr); @@ -1004,6 +1005,8 @@ sock_s_gethostbyaddr(int argc, VALUE *argv, VALUE _) VALUE ary, names; int t = AF_INET; + rb_warn("Socket.gethostbyaddr is deprecated; use Addrinfo#getnameinfo instead."); + rb_scan_args(argc, argv, "11", &addr, &family); StringValue(addr); if (!NIL_P(family)) { |