David Drysdale
f1bcfa1122
api: Allow injection of user-specified malloc/free functions
...
Add a new ares_library_init_mem() initialization function for the
library which allows the library user to specify their own malloc,
realloc & free equivalents for use library-wide.
Store these function pointers in library-wide global variables,
defaulting to libc's malloc(), realloc() and free().
Change all calls to malloc, realloc and free to use the function pointer
instead. Also ensure that ares_strdup() is always available
(even if the local environment includes strdup(3)), and change the
library code to always use it.
Convert calls to calloc() to use ares_malloc() + memset
9 years ago
David Drysdale
52c9bc57bd
ares_gethostbyname: don't leak valid-but-empty hostent
...
If an AF_UNSPEC query gets a valid response to its AAAA query,
but which has no IPv6 addresses in it, then the code chains on to
a A record query. However, the hostent from the AAAA response
was being leaked along the way (because it gets replaced before
the follow-on end_hquery() invocation).
9 years ago
Jakub Hrozek
c1fe47f6d9
host_callback: Fall back to AF_INET on searching with AF_UNSPEC
...
Previously, when an ares_gethostbyname() searched with AF_UNSPEC and the
first AF_INET6 call only returned CNAMEs, the host_callback never
retried AF_INET.
This patch makes sure than on ARES_SUCCESS, the result of AF_INET6 is
taken as authoritative only if the result contains some addresses.
11 years ago
Daniel Stenberg
cf7ad9758d
ares_inet_pton/ntop: cleanup
...
Make sure that the symbols are always exported and present in c-ares.
Make the headers prefixed with 'ares'.
Removed the inet_ntop.h version as it no longer features any content.
12 years ago
Daniel Stenberg
2a3a63ae1f
ares__bitncmp: use two underscores for private functions
...
It used a single one previously making it look like a public one
12 years ago
Yang Tse
0c677f578e
setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>
...
Inclusion of these two header files now done in setup_once.h
12 years ago
Yang Tse
a1035276c1
Header inclusion clean-up
...
Remove header inclusions already done in setup_once.h
12 years ago
Yang Tse
14eb79f660
warnings: fix some 'conversion may lose significant bits' compiler warnings
13 years ago
Jakub Hrozek
bb4096effe
Only fall back to AF_INET searches when looking for AF_UNSPEC addresses
13 years ago
Jakub Hrozek
159b82c056
Revert "Only fall back to AF_INET searches when looking for AF_UNSPEC addresses"
...
This reverts commit b5823d6570
.
This patch was not reviewed properly before pushing
14 years ago
Jakub Hrozek
b5823d6570
Only fall back to AF_INET searches when looking for AF_UNSPEC addresses
14 years ago
Yang Tse
5e5c0132e6
renamed getplatform() to ares__getplatform() to avoid namespace pollution
14 years ago
Yang Tse
5b6a188909
build: move platform stuff to ares_platform.c and ares_platform.h
14 years ago
Yang Tse
bd066ab8ef
build: find out windows platform using GetVersionEx()
14 years ago
Daniel Stenberg
0e8dc6f18e
style: make code less than 80 columns wide
15 years ago
Daniel Stenberg
63627fa5ab
remove all $Id$ lines
15 years ago
Yang Tse
e51156c080
removed usage of 's6_addr', fixing compilation issue triggered with no
...
15 years ago
Yang Tse
8fe746fcf2
Added IPv6 name servers support
15 years ago
Yang Tse
a82a8fbf82
Renamed c-ares setup.h to ares_setup.h
15 years ago
Steinar H. Gunderson
cef560e871
Support lookup of IPv4 literals in ares_gethostbyname(), even when the address family is set to AF_INET6.
15 years ago
Yang Tse
737707bf4b
fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit value
16 years ago
Phil Blundell
3f7fc80ab5
* February 3 2009 (Phil Blundell)
...
- If the server returns garbage or nothing at all in response to an AAAA query,
go on and ask for A records anyway.
16 years ago
Daniel Stenberg
1ce8e6583e
- ares_gethostbyname() now accepts 'AF_UNSPEC' as a family for resolving
...
either AF_INET6 or AF_INET. It works by accepting any of the looksups in the
hosts file, and it resolves the AAAA field with a fallback to A.
16 years ago
Gisle Vanem
f94afa4fdc
Constified some arguments in local functions.
16 years ago
Yang Tse
aa1534eb20
In preparation for the upcomming IPv6 nameservers patch, the internal
...
ares_addr union is now changed into an internal struct which also holds
the address family.
16 years ago
Daniel Stenberg
acf5ca090a
use unsigned short better intead of mixing with ints to prevent compiler
...
warnings
16 years ago
Daniel Stenberg
8a6b51d560
- Brad Spencer brought the new function ares_gethostbyname_file() which simply
...
resolves a host name from the given file, using the regular hosts syntax.
16 years ago
Yang Tse
f214b583f5
adjust inclusion of "nameser.h"
16 years ago
Yang Tse
f2582d6949
include header file only when available
16 years ago
Yang Tse
2cb5cbba34
move inclusion of ares_private.h last
16 years ago
Daniel Stenberg
93e7573628
- Phil Blundell: If you ask ares_gethostbyname() to do an AF_INET6 lookup and
...
the target host has only A records, it automatically falls back to an
AF_INET lookup and gives you the A results. However, if the target host has
a CNAME record, this behaviour is defeated since the original query does
return some data even though ares_parse_aaa_reply() doesn't consider it
relevant. Here's a small patch to make it behave the same with and without
the CNAME.
17 years ago
Daniel Stenberg
7829b79768
check for strings.h in configure and use it for the strcasecmp() proto
17 years ago
Yang Tse
c73ff0391f
fix compiler warning: local variable may be used without having been initialized
17 years ago
Daniel Stenberg
ba5bd647f9
fix next_lookup() to continue searching even if c-ares failed to load the
...
/etc/hosts file, pointed out by Erik Kline:
http://daniel.haxx.se/projects/c-ares/mail/c-ares-archive-2007-11/0027.shtml
17 years ago
Steinar H. Gunderson
d9dd239771
When looking up in DNS and then in the hosts file, return the error code from DNS if both fail, instead of returning the error code from the hosts file, as today. Patch from the Google tree.
17 years ago
Steinar H. Gunderson
b4bdb6d4d7
Return TTL data from ares_parse_{a,aaaa}_reply, if the user is so inclined. Patch from the Google tree.
17 years ago
Daniel Stenberg
338d59bd0b
Fixed the problem where next_lookup would use 'status' uninitialized. Now
...
it gets passed the initial value as an argument.
17 years ago
Steinar H. Gunderson
879f89a989
Fix a memory leak that I recently inadvertedly introduced.
17 years ago
Steinar H. Gunderson
60519063ea
Use ISDIGIT instead of isdigit; fixes a gcc warning.
17 years ago
Steinar H. Gunderson
cccd9a58cd
Be stricter about what's a valid IP address in fake_hostent. (Patch from the Google tree.)
17 years ago
Steinar H. Gunderson
3b5e49995f
Unrevert previous 'missing' hunks. They were missing since the patch is still in for review :-)
17 years ago
Steinar H. Gunderson
f785dbd9c4
Yet more missing hunks... Nggh.
17 years ago
Steinar H. Gunderson
50ba81cd23
Make the query callbacks return the number of timeouts that happened during the execution of a query, and update documentation accordingly. (Patch from the Google tree.)
17 years ago
Daniel Stenberg
9089e0c26c
Revered Ashish Sharma's multiple entries patch, as it caused memory madness
18 years ago
Daniel Stenberg
4e27354b82
Ashish Sharma provided a patch for supporting multiple entries in the
...
/etc/hosts file. Patch edited for coding style and functionality by me
(Daniel).
18 years ago
Gisle Vanem
a627160041
Removed inclusion of <sys/types.h> in .c-files
...
since it's already included through "setup.h".
18 years ago
Yang Tse
679a675660
add debug messages for initialization failures
18 years ago
Yang Tse
3c90d9d6d3
fix compiler warning "discards qualifiers from pointer target type" in debug builds
18 years ago
Gisle Vanem
415e2ae109
Fixed comment.
19 years ago
Gisle Vanem
0a83c1e416
2nd try adding CVS id.
19 years ago