зеркало из https://github.com/github/ruby.git
Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddr
This commit is contained in:
Родитель
56dd578d7e
Коммит
6d946665bd
|
@ -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)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче