diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 15:14:23 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 15:14:23 +0000 |
commit | 667af1ee3149ba51a5559a3db3d1fc52fda06bed (patch) | |
tree | b39bc8069e54f596b8cf89829bf202fe96a3f661 /win32 | |
parent | aac5c2c7affaa188b84c4f9ccf8b21e83aa21141 (diff) |
merge revision(s) r45046,r45047,r45063,r45087,r45146,r45150,r45151,r45152: [Backport #9525]
* ext/socket: Wrap struct addrinfo by struct rb_addrinfo.
* ext/socket: Bypass getaddrinfo() if node and serv are numeric.
Reporeted by Naotoshi Seo. [ruby-core:60801] [Bug #9525]
* ext/socket/extconf.rb: Detect struct sockaddr_in6.sin6_len.
* ext/socket/sockport.h (SET_SIN6_LEN): New macro.
(INIT_SOCKADDR_IN6): Ditto.
* ext/socket/rubysocket.h (struct rb_addrinfo): Add
allocated_by_malloc field.
* ext/socket/raddrinfo.c (numeric_getaddrinfo): New function.
(rb_getaddrinfo): Call numeric_getaddrinfo at first.
(rb_freeaddrinfo): Free struct addrinfo properly when it is
allocated by numeric_getaddrinfo.
* ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc.
Suggested by Eric Wong.
https://bugs.ruby-lang.org/issues/9525#note-14
* ext/socket/raddrinfo.c (rb_getaddrinfo): second argument of
MEMZERO is type. Coverity Scan found this bug.
* include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a
wrapper function for inet_pton minimum supported client is
Vista, as well as inet_ntop.
* ext/socket/option.c (inet_pton): use rb_w32_inet_pton, instead of
inet_ntop directly, which is unavailable on older version Windows.
* ext/socket/raddrinfo.c (inet_pton): use rb_w32_inet_pton, instead of
inet_pton directly, which is unavailable on older version Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index a2ced890ff..3051a97f56 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -6963,6 +6963,19 @@ rb_w32_inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len) } /* License: Ruby's */ +int WSAAPI +rb_w32_inet_pton(int af, const char *src, void *dst) +{ + typedef int (WSAAPI inet_pton_t)(int, const char*, void *); + inet_pton_t *pInetPton; + pInetPton = (inet_pton_t *)get_proc_address("ws2_32", "inet_pton", NULL); + if (pInetPton) { + return pInetPton(af, src, dst); + } + return 0; +} + +/* License: Ruby's */ char rb_w32_fd_is_text(int fd) { |