Browse Source

deps: sync with upstream bagder/c-ares@bba4dc5

Fixes: https://github.com/iojs/io.js/issues/1676
PR-URL: https://github.com/iojs/io.js/pull/1678
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
v2.0.2
Ben Noordhuis 10 years ago
parent
commit
7e1c0e75ed
  1. 5
      deps/cares/cares.gyp
  2. 51
      deps/cares/include/ares.h
  3. 4
      deps/cares/include/ares_version.h
  4. 5
      deps/cares/src/ares__read_line.c
  5. 5
      deps/cares/src/ares_gethostbyname.c
  6. 20
      deps/cares/src/ares_getnameinfo.c
  7. 8
      deps/cares/src/ares_getsock.c
  8. 13
      deps/cares/src/ares_init.c
  9. 2
      deps/cares/src/ares_ipv6.h
  10. 4
      deps/cares/src/ares_library_init.c
  11. 48
      deps/cares/src/ares_nowarn.c
  12. 3
      deps/cares/src/ares_options.c
  13. 5
      deps/cares/src/ares_parse_soa_reply.c
  14. 5
      deps/cares/src/ares_parse_txt_reply.c
  15. 7
      deps/cares/src/ares_private.h
  16. 17
      deps/cares/src/ares_process.c
  17. 14
      deps/cares/src/ares_rules.h
  18. 2
      deps/cares/src/ares_search.c
  19. 8
      deps/cares/src/ares_setup.h
  20. 9
      deps/cares/src/ares_timeout.c
  21. 132
      deps/cares/src/config-win32.h

5
deps/cares/cares.gyp

@ -26,7 +26,6 @@
'direct_dependent_settings': { 'direct_dependent_settings': {
'include_dirs': [ 'include' ] 'include_dirs': [ 'include' ]
}, },
'defines': [ 'HAVE_CONFIG_H' ],
'sources': [ 'sources': [
'common.gypi', 'common.gypi',
'include/ares.h', 'include/ares.h',
@ -96,7 +95,6 @@
'src/inet_ntop.c', 'src/inet_ntop.c',
'src/ares_inet_net_pton.h', 'src/ares_inet_net_pton.h',
'src/setup_once.h', 'src/setup_once.h',
'src/windows_port.c'
], ],
'conditions': [ 'conditions': [
[ 'library=="static_library"', { [ 'library=="static_library"', {
@ -107,7 +105,7 @@
[ 'OS=="win"', { [ 'OS=="win"', {
'include_dirs': [ 'config/win32' ], 'include_dirs': [ 'config/win32' ],
'sources': [ 'sources': [
'config/win32/ares_config.h', 'src/config-win32.h',
'src/windows_port.c', 'src/windows_port.c',
'src/ares_getenv.c', 'src/ares_getenv.c',
'src/ares_iphlpapi.h', 'src/ares_iphlpapi.h',
@ -126,6 +124,7 @@
'-Wextra', '-Wextra',
'-Wno-unused-parameter' '-Wno-unused-parameter'
], ],
'defines': [ 'HAVE_CONFIG_H' ],
}], }],
[ 'OS not in "win android"', { [ 'OS not in "win android"', {
'cflags': [ 'cflags': [

51
deps/cares/include/ares.h

@ -29,55 +29,8 @@
# define WIN32 # define WIN32
#endif #endif
/*************************** libuv patch ***************/
/*
* We want to avoid autoconf altogether since there are a finite number of
* operating systems and simply build c-ares. Therefore we do not want the
* configurations provided by ares_build.h since we are always statically
* linking c-ares into libuv. Having a system dependent ares_build.h forces
* all users of ares.h to include the correct ares_build.h. We do not care
* about the linking checks provided by ares_rules.h. This would complicate
* the libuv build process.
*/
#if defined(WIN32)
/* Configure process defines this to 1 when it finds out that system */
/* header file ws2tcpip.h must be included by the external interface. */
/* #undef CARES_PULL_WS2TCPIP_H */
# include <winsock2.h>
# include <ws2tcpip.h>
# include <windows.h>
#else /* Not Windows */
# include <sys/time.h>
# include <sys/types.h>
# include <sys/socket.h>
#endif
#if 0
/* The size of `long', as computed by sizeof. */
#define CARES_SIZEOF_LONG 4
#endif
/* Integral data type used for ares_socklen_t. */
#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
#if 0
/* The size of `ares_socklen_t', as computed by sizeof. */
#define CARES_SIZEOF_ARES_SOCKLEN_T 4
#endif
/* Data type definition of ares_socklen_t. */ /* Data type definition of ares_socklen_t. */
typedef int ares_socklen_t; typedef unsigned ares_socklen_t;
#if 0 /* libuv disabled */
#include "ares_rules.h" /* c-ares rules enforcement */
#endif
/*********************** end libuv patch ***************/
#include <sys/types.h> #include <sys/types.h>
@ -520,8 +473,6 @@ struct ares_txt_reply {
struct ares_txt_reply *next; struct ares_txt_reply *next;
unsigned char *txt; unsigned char *txt;
size_t length; /* length excludes null termination */ size_t length; /* length excludes null termination */
unsigned char record_start; /* 1 - if start of new record
* 0 - if a chunk in the same record */
}; };
struct ares_naptr_reply { struct ares_naptr_reply {

4
deps/cares/include/ares_version.h

@ -7,11 +7,11 @@
#define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 10 #define ARES_VERSION_MINOR 10
#define ARES_VERSION_PATCH 0 #define ARES_VERSION_PATCH 1
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH)) (ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.10.0-DEV" #define ARES_VERSION_STR "1.10.1-DEV"
#if (ARES_VERSION >= 0x010700) #if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1 # define CARES_HAVE_ARES_LIBRARY_INIT 1

5
deps/cares/src/ares__read_line.c

@ -61,7 +61,10 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
/* Allocate more space. */ /* Allocate more space. */
newbuf = realloc(*buf, *bufsize * 2); newbuf = realloc(*buf, *bufsize * 2);
if (!newbuf) if (!newbuf)
return ARES_ENOMEM; {
free(*buf);
return ARES_ENOMEM;
}
*buf = newbuf; *buf = newbuf;
*bufsize *= 2; *bufsize *= 2;
} }

5
deps/cares/src/ares_gethostbyname.c

@ -188,8 +188,9 @@ static void host_callback(void *arg, int status, int timeouts,
else if (hquery->sent_family == AF_INET6) else if (hquery->sent_family == AF_INET6)
{ {
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL); status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
if ((status == ARES_ENODATA || status == ARES_EBADRESP) && if ((status == ARES_ENODATA || status == ARES_EBADRESP ||
hquery->want_family == AF_UNSPEC) { (status == ARES_SUCCESS && host && host->h_addr_list[0] == NULL)) &&
hquery->want_family == AF_UNSPEC) {
/* The query returned something but either there were no AAAA /* The query returned something but either there were no AAAA
records (e.g. just CNAME) or the response was malformed. Try records (e.g. just CNAME) or the response was malformed. Try
looking up A instead. */ looking up A instead. */

20
deps/cares/src/ares_getnameinfo.c

@ -281,6 +281,8 @@ static char *lookup_service(unsigned short port, int flags,
struct servent se; struct servent se;
#endif #endif
char tmpbuf[4096]; char tmpbuf[4096];
char *name;
size_t name_len;
if (port) if (port)
{ {
@ -323,14 +325,20 @@ static char *lookup_service(unsigned short port, int flags,
#endif #endif
} }
if (sep && sep->s_name) if (sep && sep->s_name)
/* get service name */ {
strcpy(tmpbuf, sep->s_name); /* get service name */
name = sep->s_name;
}
else else
/* get port as a string */ {
sprintf(tmpbuf, "%u", (unsigned int)ntohs(port)); /* get port as a string */
if (strlen(tmpbuf) < buflen) sprintf(tmpbuf, "%u", (unsigned int)ntohs(port));
name = tmpbuf;
}
name_len = strlen(name);
if (name_len < buflen)
/* return it if buffer big enough */ /* return it if buffer big enough */
strcpy(buf, tmpbuf); memcpy(buf, name, name_len + 1);
else else
/* avoid reusing previous one */ /* avoid reusing previous one */
buf[0] = '\0'; buf[0] = '\0';

8
deps/cares/src/ares_getsock.c

@ -30,9 +30,7 @@ int ares_getsock(ares_channel channel,
/* Are there any active queries? */ /* Are there any active queries? */
int active_queries = !ares__is_list_empty(&(channel->all_queries)); int active_queries = !ares__is_list_empty(&(channel->all_queries));
for (i = 0; for (i = 0; i < channel->nservers; i++)
(i < channel->nservers) && (sockindex < ARES_GETSOCK_MAXNUM);
i++)
{ {
server = &channel->servers[i]; server = &channel->servers[i];
/* We only need to register interest in UDP sockets if we have /* We only need to register interest in UDP sockets if we have
@ -40,7 +38,7 @@ int ares_getsock(ares_channel channel,
*/ */
if (active_queries && server->udp_socket != ARES_SOCKET_BAD) if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
{ {
if(sockindex >= numsocks) if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM)
break; break;
socks[sockindex] = server->udp_socket; socks[sockindex] = server->udp_socket;
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
@ -52,7 +50,7 @@ int ares_getsock(ares_channel channel,
*/ */
if (server->tcp_socket != ARES_SOCKET_BAD) if (server->tcp_socket != ARES_SOCKET_BAD)
{ {
if(sockindex >= numsocks) if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM)
break; break;
socks[sockindex] = server->tcp_socket; socks[sockindex] = server->tcp_socket;
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);

13
deps/cares/src/ares_init.c

@ -266,7 +266,10 @@ int ares_dup(ares_channel *dest, ares_channel src)
which is most of them */ which is most of them */
rc = ares_save_options(src, &opts, &optmask); rc = ares_save_options(src, &opts, &optmask);
if(rc) if(rc)
{
ares_destroy_options(&opts);
return rc; return rc;
}
/* Then create the new channel with those options */ /* Then create the new channel with those options */
rc = ares_init_options(dest, &opts, optmask); rc = ares_init_options(dest, &opts, optmask);
@ -1158,20 +1161,24 @@ static int init_by_resolv_conf(ares_channel channel)
FILE *fp; FILE *fp;
size_t linesize; size_t linesize;
int error; int error;
int update_domains;
/* Don't read resolv.conf and friends if we don't have to */ /* Don't read resolv.conf and friends if we don't have to */
if (ARES_CONFIG_CHECK(channel)) if (ARES_CONFIG_CHECK(channel))
return ARES_SUCCESS; return ARES_SUCCESS;
/* Only update search domains if they're not already specified */
update_domains = (channel->ndomains == -1);
fp = fopen(PATH_RESOLV_CONF, "r"); fp = fopen(PATH_RESOLV_CONF, "r");
if (fp) { if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{ {
if ((p = try_config(line, "domain", ';'))) if ((p = try_config(line, "domain", ';')) && update_domains)
status = config_domain(channel, p); status = config_domain(channel, p);
else if ((p = try_config(line, "lookup", ';')) && !channel->lookups) else if ((p = try_config(line, "lookup", ';')) && !channel->lookups)
status = config_lookup(channel, p, "bind", "file"); status = config_lookup(channel, p, "bind", "file");
else if ((p = try_config(line, "search", ';'))) else if ((p = try_config(line, "search", ';')) && update_domains)
status = set_search(channel, p); status = set_search(channel, p);
else if ((p = try_config(line, "nameserver", ';')) && else if ((p = try_config(line, "nameserver", ';')) &&
channel->nservers == -1) channel->nservers == -1)
@ -1410,7 +1417,7 @@ static int init_by_defaults(ares_channel channel)
goto error; goto error;
} }
} WHILE_FALSE; } while (res != 0);
dot = strchr(hostname, '.'); dot = strchr(hostname, '.');
if (dot) { if (dot) {

2
deps/cares/src/ares_ipv6.h

@ -71,7 +71,7 @@ struct addrinfo
#endif #endif
#endif #endif
/* Defined in ares_net_pton.c for no particular reason. */ /* Defined in inet_net_pton.c for no particular reason. */
extern const struct ares_in6_addr ares_in6addr_any; /* :: */ extern const struct ares_in6_addr ares_in6addr_any; /* :: */

4
deps/cares/src/ares_library_init.c

@ -45,7 +45,7 @@ static int ares_win32_init(void)
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
hnd_iphlpapi = 0; hnd_iphlpapi = 0;
hnd_iphlpapi = LoadLibraryW(L"iphlpapi.dll"); hnd_iphlpapi = LoadLibrary("iphlpapi.dll");
if (!hnd_iphlpapi) if (!hnd_iphlpapi)
return ARES_ELOADIPHLPAPI; return ARES_ELOADIPHLPAPI;
@ -73,7 +73,7 @@ static int ares_win32_init(void)
*/ */
hnd_advapi32 = 0; hnd_advapi32 = 0;
hnd_advapi32 = LoadLibraryW(L"advapi32.dll"); hnd_advapi32 = LoadLibrary("advapi32.dll");
if (hnd_advapi32) if (hnd_advapi32)
{ {
ares_fpSystemFunction036 = (fpSystemFunction036_t) ares_fpSystemFunction036 = (fpSystemFunction036_t)

48
deps/cares/src/ares_nowarn.c

@ -1,5 +1,5 @@
/* Copyright (C) 2010-2012 by Daniel Stenberg /* Copyright (C) 2010-2013 by Daniel Stenberg
* *
* Permission to use, copy, modify, and distribute this * Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without * software and its documentation for any purpose and without
@ -21,6 +21,10 @@
# include <assert.h> # include <assert.h>
#endif #endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#if defined(__INTEL_COMPILER) && defined(__unix__) #if defined(__INTEL_COMPILER) && defined(__unix__)
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
@ -36,13 +40,43 @@
#include "ares_nowarn.h" #include "ares_nowarn.h"
#define CARES_MASK_USHORT (~(unsigned short) 0) #if (SIZEOF_SHORT == 2)
#define CARES_MASK_UINT (~(unsigned int) 0) # define CARES_MASK_SSHORT 0x7FFF
#define CARES_MASK_ULONG (~(unsigned long) 0) # define CARES_MASK_USHORT 0xFFFF
#elif (SIZEOF_SHORT == 4)
# define CARES_MASK_SSHORT 0x7FFFFFFF
# define CARES_MASK_USHORT 0xFFFFFFFF
#elif (SIZEOF_SHORT == 8)
# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF
# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF
#else
# error "SIZEOF_SHORT not defined"
#endif
#define CARES_MASK_SSHORT (CARES_MASK_USHORT >> 1) #if (SIZEOF_INT == 2)
#define CARES_MASK_SINT (CARES_MASK_UINT >> 1) # define CARES_MASK_SINT 0x7FFF
#define CARES_MASK_SLONG (CARES_MASK_ULONG >> 1) # define CARES_MASK_UINT 0xFFFF
#elif (SIZEOF_INT == 4)
# define CARES_MASK_SINT 0x7FFFFFFF
# define CARES_MASK_UINT 0xFFFFFFFF
#elif (SIZEOF_INT == 8)
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF
#elif (SIZEOF_INT == 16)
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
#else
# error "SIZEOF_INT not defined"
#endif
#ifndef HAVE_LIMITS_H
/* systems without <limits.h> we guess have 32 bit longs */
#define CARES_MASK_SLONG 0x7FFFFFFFL
#define CARES_MASK_ULONG 0xFFFFFFFFUL
#else
#define CARES_MASK_ULONG ULONG_MAX
#define CARES_MASK_SLONG LONG_MAX
#endif
/* /*
** unsigned size_t to signed long ** unsigned size_t to signed long

3
deps/cares/src/ares_options.c

@ -158,6 +158,9 @@ int ares_set_servers_csv(ares_channel channel,
return ARES_SUCCESS; /* blank all servers */ return ARES_SUCCESS; /* blank all servers */
csv = malloc(i + 2); csv = malloc(i + 2);
if (!csv)
return ARES_ENOMEM;
strcpy(csv, _csv); strcpy(csv, _csv);
if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */ if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */
csv[i] = ','; csv[i] = ',';

5
deps/cares/src/ares_parse_soa_reply.c

@ -86,7 +86,10 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen,
/* allocate result struct */ /* allocate result struct */
soa = ares_malloc_data(ARES_DATATYPE_SOA_REPLY); soa = ares_malloc_data(ARES_DATATYPE_SOA_REPLY);
if (!soa) if (!soa)
return ARES_ENOMEM; {
status = ARES_ENOMEM;
goto failed_stat;
}
/* nsname */ /* nsname */
status = ares__expand_name_for_response(aptr, abuf, alen, &soa->nsname, &len); status = ares__expand_name_for_response(aptr, abuf, alen, &soa->nsname, &len);

5
deps/cares/src/ares_parse_txt_reply.c

@ -133,6 +133,8 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
break; break;
} }
++strptr;
/* Allocate storage for this TXT answer appending it to the list */ /* Allocate storage for this TXT answer appending it to the list */
txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY); txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY);
if (!txt_curr) if (!txt_curr)
@ -150,7 +152,6 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
} }
txt_last = txt_curr; txt_last = txt_curr;
txt_curr->record_start = strptr == aptr;
txt_curr->length = substr_len; txt_curr->length = substr_len;
txt_curr->txt = malloc (substr_len + 1/* Including null byte */); txt_curr->txt = malloc (substr_len + 1/* Including null byte */);
if (txt_curr->txt == NULL) if (txt_curr->txt == NULL)
@ -158,8 +159,6 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
status = ARES_ENOMEM; status = ARES_ENOMEM;
break; break;
} }
++strptr;
memcpy ((char *) txt_curr->txt, strptr, substr_len); memcpy ((char *) txt_curr->txt, strptr, substr_len);
/* Make sure we NULL-terminate */ /* Make sure we NULL-terminate */

7
deps/cares/src/ares_private.h

@ -310,12 +310,7 @@ struct ares_channeldata {
/* return true if now is exactly check time or later */ /* return true if now is exactly check time or later */
int ares__timedout(struct timeval *now, int ares__timedout(struct timeval *now,
struct timeval *check); struct timeval *check);
/* add the specific number of milliseconds to the time in the first argument */
int ares__timeadd(struct timeval *now,
int millisecs);
/* return time offset between now and (future) check, in milliseconds */
long ares__timeoffset(struct timeval *now,
struct timeval *check);
/* returns ARES_SUCCESS if library has been initialized */ /* returns ARES_SUCCESS if library has been initialized */
int ares_library_initialized(void); int ares_library_initialized(void);
void ares__send_query(ares_channel channel, struct query *query, void ares__send_query(ares_channel channel, struct query *query,

17
deps/cares/src/ares_process.c

@ -102,8 +102,7 @@ int ares__timedout(struct timeval *now,
} }
/* add the specific number of milliseconds to the time in the first argument */ /* add the specific number of milliseconds to the time in the first argument */
int ares__timeadd(struct timeval *now, static void timeadd(struct timeval *now, int millisecs)
int millisecs)
{ {
now->tv_sec += millisecs/1000; now->tv_sec += millisecs/1000;
now->tv_usec += (millisecs%1000)*1000; now->tv_usec += (millisecs%1000)*1000;
@ -112,19 +111,8 @@ int ares__timeadd(struct timeval *now,
++(now->tv_sec); ++(now->tv_sec);
now->tv_usec -= 1000000; now->tv_usec -= 1000000;
} }
return 0;
}
/* return time offset between now and (future) check, in milliseconds */
long ares__timeoffset(struct timeval *now,
struct timeval *check)
{
return (check->tv_sec - now->tv_sec)*1000 +
(check->tv_usec - now->tv_usec)/1000;
} }
/* /*
* generic process function * generic process function
*/ */
@ -831,8 +819,7 @@ void ares__send_query(ares_channel channel, struct query *query,
timeplus = channel->timeout << (query->try_count / channel->nservers); timeplus = channel->timeout << (query->try_count / channel->nservers);
timeplus = (timeplus * (9 + (rand () & 7))) / 16; timeplus = (timeplus * (9 + (rand () & 7))) / 16;
query->timeout = *now; query->timeout = *now;
ares__timeadd(&query->timeout, timeadd(&query->timeout, timeplus);
timeplus);
/* Keep track of queries bucketed by timeout, so we can process /* Keep track of queries bucketed by timeout, so we can process
* timeout events quickly. * timeout events quickly.
*/ */

14
deps/cares/src/ares_rules.h

@ -68,11 +68,6 @@
* Verify that some macros are actually defined. * Verify that some macros are actually defined.
*/ */
#ifndef CARES_SIZEOF_LONG
# error "CARES_SIZEOF_LONG definition is missing!"
Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing
#endif
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T #ifndef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!" # error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
@ -91,15 +86,6 @@
#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 #define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
/*
* Verify that the size previously defined and expected for long
* is the same as the one reported by sizeof() at compile time.
*/
typedef char
__cares_rule_01__
[CareschkszEQ(long, CARES_SIZEOF_LONG)];
/* /*
* Verify that the size previously defined and expected for * Verify that the size previously defined and expected for
* ares_socklen_t is actually the the same as the one reported * ares_socklen_t is actually the the same as the one reported

2
deps/cares/src/ares_search.c

@ -239,7 +239,7 @@ static int single_domain(ares_channel channel, const char *name, char **s)
/* If the name contains a trailing dot, then the single query is the name /* If the name contains a trailing dot, then the single query is the name
* sans the trailing dot. * sans the trailing dot.
*/ */
if (name[len - 1] == '.') if ((len > 0) && (name[len - 1] == '.'))
{ {
*s = strdup(name); *s = strdup(name);
return (*s) ? ARES_SUCCESS : ARES_ENOMEM; return (*s) ? ARES_SUCCESS : ARES_ENOMEM;

8
deps/cares/src/ares_setup.h

@ -75,9 +75,9 @@
/* please, do it beyond the point further indicated in this file. */ /* please, do it beyond the point further indicated in this file. */
/* ================================================================ */ /* ================================================================ */
#if 1 /* libuv hack */ #if 1
#include <errno.h> /* needed on windows */ # define SIZEOF_SHORT 2
#else #else /* Disabled for the gyp-ified build. */
/* /*
* c-ares external interface definitions are also used internally, * c-ares external interface definitions are also used internally,
* and might also include required system header files to define them. * and might also include required system header files to define them.
@ -90,7 +90,7 @@
*/ */
#include <ares_rules.h> #include <ares_rules.h>
#endif /* libuv hack */ #endif
/* ================================================================= */ /* ================================================================= */
/* No system header file shall be included in this file before this */ /* No system header file shall be included in this file before this */

9
deps/cares/src/ares_timeout.c

@ -23,6 +23,13 @@
#include "ares.h" #include "ares.h"
#include "ares_private.h" #include "ares_private.h"
/* return time offset between now and (future) check, in milliseconds */
static long timeoffset(struct timeval *now, struct timeval *check)
{
return (check->tv_sec - now->tv_sec)*1000 +
(check->tv_usec - now->tv_usec)/1000;
}
/* WARNING: Beware that this is linear in the number of outstanding /* WARNING: Beware that this is linear in the number of outstanding
* requests! You are probably far better off just calling ares_process() * requests! You are probably far better off just calling ares_process()
* once per second, rather than calling ares_timeout() to figure out * once per second, rather than calling ares_timeout() to figure out
@ -53,7 +60,7 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
query = list_node->data; query = list_node->data;
if (query->timeout.tv_sec == 0) if (query->timeout.tv_sec == 0)
continue; continue;
offset = ares__timeoffset(&now, &query->timeout); offset = timeoffset(&now, &query->timeout);
if (offset < 0) if (offset < 0)
offset = 0; offset = 0;
if (min_offset == -1 || offset < min_offset) if (min_offset == -1 || offset < min_offset)

132
deps/cares/config/win32/ares_config.h → deps/cares/src/config-win32.h

@ -1,10 +1,7 @@
#ifndef __ARES_CONFIG_WIN32_H #ifndef HEADER_CARES_CONFIG_WIN32_H
#define __ARES_CONFIG_WIN32_H #define HEADER_CARES_CONFIG_WIN32_H
/* when building c-ares library */ /* Copyright (C) 2004 - 2011 by Daniel Stenberg et al
#define CARES_BUILDING_LIBRARY 1
/* Copyright (C) 2004 - 2008 by Daniel Stenberg et al
* *
* Permission to use, copy, modify, and distribute this software and its * Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided * documentation for any purpose and without fee is hereby granted, provided
@ -17,25 +14,29 @@
* without express or implied warranty. * without express or implied warranty.
*/ */
#define ARES_
/* ================================================================ */ /* ================================================================ */
/* ares/config-win32.h - Hand crafted config file for Windows */ /* c-ares/config-win32.h - Hand crafted config file for Windows */
/* ================================================================ */ /* ================================================================ */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* HEADER FILES */ /* HEADER FILES */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define if you have the <getopt.h> header file. */ /* Define if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if you have the <getopt.h> header file. */
#if defined(__MINGW32__) || defined(__POCC__) #if defined(__MINGW32__) || defined(__POCC__)
#define HAVE_GETOPT_H 1 #define HAVE_GETOPT_H 1
#endif #endif
/* Define if you have the <limits.h> header file. */ /* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1 #define HAVE_LIMITS_H 1
/* Define if you have the <process.h> header file. */ /* Define if you have the <process.h> header file. */
#ifndef __SALFORDC__ #ifndef __SALFORDC__
#define HAVE_PROCESS_H 1 #define HAVE_PROCESS_H 1
#endif #endif
@ -44,31 +45,29 @@
#define HAVE_SIGNAL_H 1 #define HAVE_SIGNAL_H 1
/* Define if you have the <sys/time.h> header file */ /* Define if you have the <sys/time.h> header file */
#if defined(__MINGW32__) /* #define HAVE_SYS_TIME_H 1 */
#define HAVE_SYS_TIME_H 1
#endif
/* Define if you have the <time.h> header file. */ /* Define if you have the <time.h> header file. */
#define HAVE_TIME_H 1 #define HAVE_TIME_H 1
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \ #if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \
defined(__POCC__) defined(__POCC__)
#define HAVE_UNISTD_H 1 #define HAVE_UNISTD_H 1
#endif #endif
/* Define if you have the windows.h header file. */ /* Define if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 1 #define HAVE_WINDOWS_H 1
/* Define if you have the <winsock.h> header file. */ /* Define if you have the <winsock.h> header file. */
#define HAVE_WINSOCK_H 1 #define HAVE_WINSOCK_H 1
/* Define if you have the <winsock2.h> header file. */ /* Define if you have the <winsock2.h> header file. */
#ifndef __SALFORDC__ #ifndef __SALFORDC__
#define HAVE_WINSOCK2_H 1 #define HAVE_WINSOCK2_H 1
#endif #endif
/* Define if you have the <ws2tcpip.h> header file. */ /* Define if you have the <ws2tcpip.h> header file. */
#ifndef __SALFORDC__ #ifndef __SALFORDC__
#define HAVE_WS2TCPIP_H 1 #define HAVE_WS2TCPIP_H 1
#endif #endif
@ -80,20 +79,23 @@
/* Define if sig_atomic_t is an available typedef. */ /* Define if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T 1 #define HAVE_SIG_ATOMIC_T 1
/* Define if you have the ANSI C header files. */ /* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */ /* Define if you can safely include both <sys/time.h> and <time.h>. */
/* #define TIME_WITH_SYS_TIME 1 */ /* #define TIME_WITH_SYS_TIME 1 */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* FUNCTIONS */ /* FUNCTIONS */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define if you have the closesocket function. */ /* Define if you have the closesocket function. */
#define HAVE_CLOSESOCKET 1 #define HAVE_CLOSESOCKET 1
/* Define if you have the gethostname function. */ /* Define if you have the getenv function. */
#define HAVE_GETENV 1
/* Define if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1 #define HAVE_GETHOSTNAME 1
/* Define if you have the ioctlsocket function. */ /* Define if you have the ioctlsocket function. */
@ -105,9 +107,6 @@
/* Define if you have the strcasecmp function. */ /* Define if you have the strcasecmp function. */
/* #define HAVE_STRCASECMP 1 */ /* #define HAVE_STRCASECMP 1 */
/* Define if you have the getenv function. */
#define HAVE_GETENV 1
/* Define if you have the strdup function. */ /* Define if you have the strdup function. */
#define HAVE_STRDUP 1 #define HAVE_STRDUP 1
@ -183,7 +182,7 @@
/* Define to the function return type for send. */ /* Define to the function return type for send. */
#define SEND_TYPE_RETV int #define SEND_TYPE_RETV int
/* Specifics for the Watt-32 tcp/ip stack */ /* Specifics for the Watt-32 tcp/ip stack. */
#ifdef WATT32 #ifdef WATT32
#define SOCKET int #define SOCKET int
#define NS_INADDRSZ 4 #define NS_INADDRSZ 4
@ -206,13 +205,13 @@
/* TYPEDEF REPLACEMENTS */ /* TYPEDEF REPLACEMENTS */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define this if in_addr_t is not an available 'typedefed' type */ /* Define if in_addr_t is not an available 'typedefed' type. */
#define in_addr_t unsigned long #define in_addr_t unsigned long
/* Define as the return type of signal handlers (int or void). */ /* Define to the return type of signal handlers (int or void). */
#define RETSIGTYPE void #define RETSIGTYPE void
/* Define ssize_t if it is not an available 'typedefed' type */ /* Define if ssize_t is not an available 'typedefed' type. */
#ifndef _SSIZE_T_DEFINED #ifndef _SSIZE_T_DEFINED
# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ # if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \
defined(__POCC__) || \ defined(__POCC__) || \
@ -230,13 +229,13 @@
/* TYPE SIZES */ /* TYPE SIZES */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* The size of `int', as computed by sizeof. */ /* Define to the size of `int', as computed by sizeof. */
#define SIZEOF_INT 4 #define SIZEOF_INT 4
/* The size of `short', as computed by sizeof. */ /* Define to the size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2 #define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */ /* Define to the size of `size_t', as computed by sizeof. */
#if defined(_WIN64) #if defined(_WIN64)
# define SIZEOF_SIZE_T 8 # define SIZEOF_SIZE_T 8
#else #else
@ -247,34 +246,35 @@
/* STRUCT RELATED */ /* STRUCT RELATED */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define this if you have struct addrinfo */ /* Define if you have struct addrinfo. */
#define HAVE_STRUCT_ADDRINFO 1 #define HAVE_STRUCT_ADDRINFO 1
/* Define this if you have struct sockaddr_storage */ /* Define if you have struct sockaddr_storage. */
#ifndef __SALFORDC__ #if !defined(__SALFORDC__) && !defined(__BORLANDC__)
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 #define HAVE_STRUCT_SOCKADDR_STORAGE 1
#endif #endif
/* Define this if you have struct timeval */ /* Define if you have struct timeval. */
#define HAVE_STRUCT_TIMEVAL 1 #define HAVE_STRUCT_TIMEVAL 1
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* COMPILER SPECIFIC */ /* COMPILER SPECIFIC */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define to avoid VS2005 complaining about portable C functions */ /* Define to avoid VS2005 complaining about portable C functions. */
#if defined(_MSC_VER) && (_MSC_VER >= 1400) #if defined(_MSC_VER) && (_MSC_VER >= 1400)
#define _CRT_SECURE_NO_DEPRECATE 1 # define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_NONSTDC_NO_DEPRECATE 1 # define _CRT_NONSTDC_NO_DEPRECATE 1
#endif #endif
/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows /* Officially, Microsoft's Windows SDK versions 6.X do not support Windows
2000 as a supported build target. VS2008 default installations provide an 2000 as a supported build target. VS2008 default installations provide
embedded Windows SDK v6.0A along with the claim that Windows 2000 is a an embedded Windows SDK v6.0A along with the claim that Windows 2000 is
valid build target for VS2008. Popular belief is that binaries built using a valid build target for VS2008. Popular belief is that binaries built
Windows SDK versions 6.X and Windows 2000 as a build target are functional */ with VS2008 using Windows SDK versions 6.X and Windows 2000 as a build
target are functional. */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) #if defined(_MSC_VER) && (_MSC_VER >= 1500)
# define VS2008_MINIMUM_TARGET 0x0500 # define VS2008_MIN_TARGET 0x0500
#endif #endif
/* When no build target is specified VS2008 default build target is Windows /* When no build target is specified VS2008 default build target is Windows
@ -282,18 +282,18 @@
for VS2008 we will target the minimum Officially supported build target, for VS2008 we will target the minimum Officially supported build target,
which happens to be Windows XP. */ which happens to be Windows XP. */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) #if defined(_MSC_VER) && (_MSC_VER >= 1500)
# define VS2008_DEFAULT_TARGET 0x0501 # define VS2008_DEF_TARGET 0x0501
#endif #endif
/* VS2008 default target settings and minimum build target check */ /* VS2008 default target settings and minimum build target check. */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) #if defined(_MSC_VER) && (_MSC_VER >= 1500)
# ifndef _WIN32_WINNT # ifndef _WIN32_WINNT
# define _WIN32_WINNT VS2008_DEFAULT_TARGET # define _WIN32_WINNT VS2008_DEF_TARGET
# endif # endif
# ifndef WINVER # ifndef WINVER
# define WINVER VS2008_DEFAULT_TARGET # define WINVER VS2008_DEF_TARGET
# endif # endif
# if (_WIN32_WINNT < VS2008_MINIMUM_TARGET) || (WINVER < VS2008_MINIMUM_TARGET) # if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET)
# error VS2008 does not support Windows build targets prior to Windows 2000 # error VS2008 does not support Windows build targets prior to Windows 2000
# endif # endif
#endif #endif
@ -340,30 +340,46 @@
/* IPV6 COMPATIBILITY */ /* IPV6 COMPATIBILITY */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define this if you have address family AF_INET6 */ /* Define if you have address family AF_INET6. */
#ifdef HAVE_WINSOCK2_H #ifdef HAVE_WINSOCK2_H
#define HAVE_AF_INET6 1 #define HAVE_AF_INET6 1
#endif #endif
/* Define this if you have protocol family PF_INET6 */ /* Define if you have protocol family PF_INET6. */
#ifdef HAVE_WINSOCK2_H #ifdef HAVE_WINSOCK2_H
#define HAVE_PF_INET6 1 #define HAVE_PF_INET6 1
#endif #endif
/* Define this if you have struct in6_addr */ /* Define if you have struct in6_addr. */
#ifdef HAVE_WS2TCPIP_H #ifdef HAVE_WS2TCPIP_H
#define HAVE_STRUCT_IN6_ADDR 1 #define HAVE_STRUCT_IN6_ADDR 1
#endif #endif
/* Define this if you have struct sockaddr_in6 */ /* Define if you have struct sockaddr_in6. */
#ifdef HAVE_WS2TCPIP_H #ifdef HAVE_WS2TCPIP_H
#define HAVE_STRUCT_SOCKADDR_IN6 1 #define HAVE_STRUCT_SOCKADDR_IN6 1
#endif #endif
/* Define this if you have sockaddr_in6 with scopeid */ /* Define if you have sockaddr_in6 with scopeid. */
#ifdef HAVE_WS2TCPIP_H #ifdef HAVE_WS2TCPIP_H
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
#endif #endif
/* ---------------------------------------------------------------- */
/* Win CE */
/* ---------------------------------------------------------------- */
/* FIXME: A proper config-win32ce.h should be created to hold these */
/*
* System error codes for Windows CE
*/
#if defined(_WIN32_WCE) && !defined(HAVE_ERRNO_H)
# define ENOENT ERROR_FILE_NOT_FOUND
# define ESRCH ERROR_PATH_NOT_FOUND
# define ENOMEM ERROR_NOT_ENOUGH_MEMORY
# define ENOSPC ERROR_INVALID_PARAMETER
#endif
#endif /* __ARES_CONFIG_WIN32_H */ #endif /* HEADER_CARES_CONFIG_WIN32_H */
Loading…
Cancel
Save