path: root/ext/psych
diff options
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 13:13:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 13:13:02 +0000
commitb5c6fc856100b17b6f20e6e792a02ee7e33306bc (patch)
tree189708e38170550aa6c315ee1306c39dd7f4b114 /ext/psych
parent7f7d5d0c905c982a75488c3b0c89154a5188b692 (diff)
Deprecation document for gethostbyname,gethostbyaddr.
[Feature #13097] I confirmed current ruby (Ruby 2.4 and trunk) uses gethostbyname() and gethostbyaddr(). Socket.gethostbyname uses getaddrinfo() and gethostbyname(). Socket.gethostbyaddr uses gethostbyaddr(). Socket.gethostbyname uses gethostbyname() to obtain alias hostnames. RFC 3493 defines getaddrinfo()/getnameinfo() and describes the problems of gethostbyname()/gethostbyaddr(). The problems are difficult protocol handling and thread-unsafety. Since Ruby has GVL, the thread-unsafety doesn't cause wrong result. But it may block other threads until finishing DNS query. Socket.gethostbyname has the protocol handling problem. It returns only one address family: ``` % ruby -rpp -rsocket -e 'pp Socket.gethostbyname("")' ["", [], 10, " \x01\x02\x00\r\xFF\xFF\xF1\x02\x16>\xFF\xFEKe\x1C", "\xCB\xB2\x89:"] ``` has one IPv6 address and one IPv4 address. But Socket.gethostbyname returns only one address family, 10 (AF_INET6), which is the address family of the first address. Also, Socket.gethostbyname and Socket.gethostbyaddr uses 4-bytes binary IPv4 address and 16-bytes binary IPv6 address. This is not usual in other socket API in Ruby. (Most socket API uses binary sockaddr string or Addrinfo object) I think Socket.gethostbyname and Socket.gethostbyaddr are too far from recommendable API. So, I added deprecation description for documents for them. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych')
0 files changed, 0 insertions, 0 deletions