Daniel Stenberg
9f341f9ce5
Gisle Vanem's improved verbose output and timeout handling when connecting to
...
a host name that resolves to multiple IP addresses.
2004-06-10 11:06:21 +00:00
Daniel Stenberg
e9056f5f95
if shrinking the buffer fails, use the older larger one
2004-05-17 22:07:43 +00:00
Daniel Stenberg
bbafb2eb27
curl_global_init_mem() allows the memory functions to be replaced.
...
memory.h is included everywhere for this.
2004-05-11 11:30:23 +00:00
Daniel Stenberg
4250637e7d
improved the cleaning up of memory when we fail to resolve names due to
...
out of memory (thanks to 'runtests.pl -t')
2004-05-04 13:40:30 +00:00
Daniel Stenberg
245e3122df
Made defines instead of plain numbers for the Curl_resolv() return code to
...
make the code easier to read
2004-04-26 14:18:00 +00:00
Daniel Stenberg
648e82f05d
Major hostip.c cleanup and split into multiple files and easier #ifdef
...
usage.
2004-04-26 07:20:11 +00:00
Daniel Stenberg
3755bffcc2
Gisle Vanem found and fixed a memory leak when doing (failing) Windows
...
threaded name resolves.
2004-04-23 14:04:30 +00:00
Daniel Stenberg
62b7c08bb3
include unistd.h as well for the close() proto on some platforms (like Tru64)
2004-04-21 11:18:42 +00:00
Daniel Stenberg
dc25cd6f3a
cleanup leftovers
2004-04-20 09:46:10 +00:00
Daniel Stenberg
68e8a0f0d9
asking for CURL_IPRESOLVE_V6 when ipv6 addresses can't be resolved will
...
now cause the resolve function to return NULL immediately
2004-04-14 12:10:44 +00:00
Daniel Stenberg
1d0b5b507a
Curl_wait_for_resolv() could hang due to the bad timeout timer resolution and
...
some bad thinking on my part.
2004-04-14 11:43:26 +00:00
Daniel Stenberg
31a693b99a
Gisle Vanem's fix that makes the multi interface work on Windows again even
...
when not using ares.
2004-04-13 13:59:12 +00:00
Daniel Stenberg
eb6345de60
somewhat safer typecasting in case sizeof(long) != sizeof(void *) (is there
...
even such platforms?)
2004-04-12 06:55:25 +00:00
Daniel Stenberg
5ca47f19d7
the pack_hostent() proto isn't used/needed with ipv6 is enabled.
...
time to restructure this source file!
2004-04-06 15:09:43 +00:00
Daniel Stenberg
9044fcbb5f
Gisle Vanem's fix for bug item #927979 reported by Nathan O'Sullivan.
...
Good enough?
2004-04-06 14:51:14 +00:00
Daniel Stenberg
ad9e83a90f
Dirk Manske's fix that makes sure we cancel the ares resolve when we time out
...
from a name resolve. Without this, we leak memory!
2004-04-01 08:40:36 +00:00
Daniel Stenberg
675db3a211
removed my previously attempted fix for ares timeouts, not needed
2004-04-01 07:04:58 +00:00
Daniel Stenberg
ee1595dcd5
Roy Shan fixed a case that prevented ares name resolve timeouts to occur.
2004-03-31 20:50:01 +00:00
Daniel Stenberg
9d0330d5bd
Remove the elapsed time from the most recent select() only.
2004-03-31 13:19:41 +00:00
Daniel Stenberg
d5074f74bb
The asynch name resolve methods now all use CURL_TIMEOUT_RESOLVE for
...
the specific time to wait for a resolve. The definition is at the top of
this source file.
2004-03-31 12:55:24 +00:00
Daniel Stenberg
ea0cf7c87b
Dirk Manske found out the Curl_wait_for_resolv() timed out too early.
2004-03-31 12:45:26 +00:00
Daniel Stenberg
b8b8473b6d
Lots of comments added an clarified. Added timeout for the ares version
...
of Curl_is_resolved() to address Roy Shan's reported problem.
2004-03-30 13:02:07 +00:00
Daniel Stenberg
dc46f535ae
The select() timeout is better not static since some implementation actually
...
might change it. I don't *think* it does it when the timeout is 0,0 but it
is better to be sure...
2004-03-29 21:29:24 +00:00
Daniel Stenberg
5b55f9ecb3
Günter Knauf's NetWare changes.
2004-03-17 12:46:42 +00:00
Daniel Stenberg
47afa058a8
store times in time_t
2004-03-10 09:36:43 +00:00
Daniel Stenberg
52d85341ae
only build with the windows threading trace code if
...
DEBUG_THREADING_GETHOSTBYNAME is defined
2004-03-09 21:42:43 +00:00
Daniel Stenberg
9116dd41bd
tv_sec is an int, so we explicitly typecast the result of long - long to
...
an int when we assign it.
2004-03-03 13:07:32 +00:00
Daniel Stenberg
f35c28214e
use size_t to keep strlen() results
2004-02-23 08:38:49 +00:00
Daniel Stenberg
35fd1365ae
simplied how create_hostcache_id() is used, and also its function somewhat
...
cleared up some ssize_t/size_t mixups
2004-02-23 08:35:57 +00:00
Daniel Stenberg
7d844c430c
Gisle Vanem brings name resolving timeout possibilities to windows people.
...
This works by magicly starting up a new thread that can be killed when the
timeout is reached. testtesttest!
2004-02-20 16:41:50 +00:00
Daniel Stenberg
62a12b7faf
No longer uses the 'ret' variable in the plain ipv4-version of
...
my_getaddrinfo() (caused a warning by the IRIX MIPSPro compiler). Also
clarified the situation for the 3-arg version of gethostbyname_r() with a huge
comment.
2004-02-18 10:05:17 +00:00
Daniel Stenberg
e2b6a45cfa
Make sure dns cache timeout -1 really means forever, as it is documented to
...
be. Simply skip the pruning.
2004-02-18 07:56:18 +00:00
Daniel Stenberg
ccdaa0b51f
Make the 'areschannel' get created in the curl_easy_init() and re-use that
...
same channel during the whole curl handle's life until curl_easy_cleanup().
2004-02-16 15:24:22 +00:00
Daniel Stenberg
a7e04cac78
Mark the dns entry 'inuse' properly even when used from the cache. This
...
seems to correct some host cache screw-ups I could reproduce.
2004-02-15 16:57:53 +00:00
Daniel Stenberg
4674f3f115
Make hostcache_fixoffset() take a long for offset, to fully work with 64bit
...
archs, also no longer typecast pointers to ints as that is a nono on 64bit
systems.
2004-02-12 16:02:55 +00:00
Daniel Stenberg
791e49134b
hide the pack_hostent proto if ipv6 is enabled, as figured out by Tor Arntsen
2004-02-05 08:34:31 +00:00
Daniel Stenberg
886391d145
adjusted to the modified ares_strerror() function
...
NOTE that this breaks ares-compatibility, we have now officially taken the
turn into the c-ares path. We will now officially depend on c-ares for asynch
name resolves.
2004-02-02 16:00:31 +00:00
Daniel Stenberg
e1d541086c
Dirk Manske fixed the ares usage even more. We could get a timeout from ares
...
as well, and when failing and not getting a timeout we now include the
error message ares can provide us with.
2004-02-02 15:53:50 +00:00
Daniel Stenberg
12fa877f00
Timeout slow ares name lookups. This is based on the patch brought by
...
Dirk Manske, but modified by me.
2004-02-02 10:15:22 +00:00
Daniel Stenberg
2d567af069
fixed the Curl_resolv()'s return code when the looked up host was already
...
in the cache (Vincent Bronner)
2004-01-14 09:05:54 +00:00
Daniel Stenberg
053f6c85ef
updated year in the copyright string
2004-01-07 09:19:33 +00:00
Daniel Stenberg
3788f25eac
added a library-wide interface for doing dns cache pruning, and no longer
...
make the pruning at each name lookup, only in Curl_done().
2003-12-15 17:33:49 +00:00
Daniel Stenberg
cfe53768dd
if Curl_hash_add() returns NULL, we shall not free the addrinfo field as that
...
is made in the hash function in the case of failure (using the already setup
'dtor' function).
2003-12-15 15:22:10 +00:00
Daniel Stenberg
06c38330ba
Steve Green fixed Curl_resolv()
2003-12-03 07:55:51 +00:00
Daniel Stenberg
a0a5668dbd
do ares_destroy() on the ares handle when we're done in Curl_is_resolved()
2003-11-15 10:29:43 +00:00
Daniel Stenberg
a701f3dddf
Siddhartha Prakash Jain found a case with a bad resolve that we didn't
...
properly bail out from, when using ares.
2003-11-14 11:56:15 +00:00
Daniel Stenberg
25613503cb
Another glibc resolve name fix
2003-10-28 13:06:15 +00:00
Daniel Stenberg
017a78d0c5
better bailing-out cleanup if a malloc fails in the DNS cache
2003-10-24 12:57:23 +00:00
Daniel Stenberg
31b6bb6a41
lock the DNS cache properly before adding an entry when using asynch DNS
2003-10-20 08:45:33 +00:00
Daniel Stenberg
749f5387c1
Gisle Vanem's IPv6-on-Windows patch applied!
2003-10-14 12:00:45 +00:00
Daniel Stenberg
022996e5c7
Dirk Manske made the share-locking around DNS lookups a bit "looser" so that
...
multiple DNS lookups can run simultaneously faster. The downside is that
resolving the same host name now can be made at once from multiple threads,
but the upside is that threads now don't alwys have to wait for the others'
resolves. Test case 506 updated accordingly.
2003-10-12 13:57:41 +00:00
Daniel Stenberg
a0118fb390
just re-indented some code
2003-10-05 15:03:21 +00:00
Daniel Stenberg
343291ce37
Based on a patch provided by Siddhartha Prakash Jain. In Curl_resolv() when
...
my_getaddrinfo() has been called (and wait has been set to TRUE), we check
if the name already is resolved and if so don't return wait status to the
parent. This can happen with IP-only names.
2003-10-04 14:50:45 +00:00
Daniel Stenberg
2297eca103
Added CURLOPT_IPRESOLVE support
2003-09-19 15:16:47 +00:00
Daniel Stenberg
14597475b1
Jeff Pohlmeyer did some marvelous debugging to track this one down. We MUST
...
NOT free the existing hash entry when we try to add a new one that matches
an existing entry. We now instead free the new one, and make the parent
function use the old entry's struct instead.
2003-09-14 21:17:54 +00:00
Daniel Stenberg
c1f31180a2
Curl_is_resolved(): FD_ZERO the file descriptors before we call ares_fds().
...
Problem tracked down by Bjorn Reese.
2003-09-11 21:27:19 +00:00
Daniel Stenberg
5629eeaec2
The error buffer was not getting filled when Curl_wait_for_resolv() fails.
...
Jeff Pohlmeyer fixed.
2003-09-01 08:21:08 +00:00
Daniel Stenberg
7e7d89471a
use proper type to prevent compiler warning
2003-08-22 12:25:47 +00:00
Daniel Stenberg
e67d15b50e
Vincent Sanders provided a fix for name resolving when linked with uClibc.
2003-08-21 12:07:47 +00:00
Daniel Stenberg
b1da98170f
make sure the 'done' variable is always set to something in the
...
Curl_is_resolved() function
2003-08-19 23:23:45 +00:00
Daniel Stenberg
33cf204e9a
don't set done==TRUE if the host name doesn't resolve
2003-08-19 09:29:59 +00:00
Daniel Stenberg
62b65a5f20
make it build without ares support
...
make sure it set async false even when using ipv6 (made test case 20 fail
before)
2003-08-06 15:26:02 +00:00
Daniel Stenberg
b73612392d
ares awareness/usage/support added. If configure --enable-ares is used, we
...
build libcurl to use ares for asynch name resolves.
2003-08-05 14:40:59 +00:00
Daniel Stenberg
556ce1c6a1
minor code style fix
2003-07-23 12:55:24 +00:00
Daniel Stenberg
308bc9d919
use CURLDEBUG instead of MALLOCDEBUG for preprocessor conditions
2003-06-26 11:22:12 +00:00
Daniel Stenberg
9a6566e774
Gisle Vanem's code for not trusting h_aliases to always be non-NULL
2003-05-20 09:41:39 +00:00
Daniel Stenberg
e615d117a0
Setup and use CURL_INADDR_NONE all over instead of INADDR_NONE. We setup
...
the define accordingly in the hostip.h header to work nicely all over.
2003-05-13 12:12:17 +00:00
Daniel Stenberg
0821447b5b
spell fix
2003-04-03 16:11:47 +00:00
Daniel Stenberg
b28b616eb2
typecast the conversion from const char * to char *
2003-03-19 09:16:59 +00:00
Daniel Stenberg
8d5ac8b43c
AIX 4.3 or later should use gethostbyname() and not the *_r() version.
2003-03-03 22:23:48 +00:00
Jean-Philippe Barette-LaPierre
beb13a1d3e
added the sharing of DNS cache
2003-02-04 23:48:46 +00:00
Daniel Stenberg
a7c72b7abf
removed the local variables for emacs and vim, use the new sample.emacs
...
way for emacs, and vim users should provide a similar non-polluting style
2003-01-29 10:14:20 +00:00
Daniel Stenberg
f26a338a54
copyright year update in the source header
2003-01-16 21:08:12 +00:00
Daniel Stenberg
e879e26a5b
EAGAIN on older (correct) glibc versions indicate a problem and not the need
...
for a bigger buffer and this is indeed badness for us. Making this work
on both old and new glibc versions require an ugly loop that in its worse
form cause 45 bad loops when using the correct glibc and a non-resolving
host name... :-/
We want a better fix. Badly.
2002-12-16 11:33:44 +00:00
Daniel Stenberg
7df5677b46
fixed Curl_freeaddrinfo() to only free addrinfo, and added Curl_freednsinfo()
...
for freeing single dns cache entries
2002-11-26 09:41:54 +00:00
Daniel Stenberg
ca6e770837
The test for DNS cache entries left locked is now only built if
...
AGGRESIVE_TEST is also defined, as an addition to MALLOCDEBUG. It doesn't
work for multi interface usage and should only be used with careful
consideration.
2002-11-11 22:51:09 +00:00
Daniel Stenberg
2cff251863
Curl_resolv() now returns a different struct, and it contains a reference
...
counter so that the caller needs to decrease that counter when done with
the returned data.
If compiled with MALLOCDEBUG I've added some extra checking that the counter
is decreased before a handle is closed etc.
2002-11-05 10:51:41 +00:00
Daniel Stenberg
5bc78cb724
Disable the DNS cache (by setting the timeout to 0) made libcurl leak
...
memory. Avery Fay brought the example code that proved this.
2002-10-31 13:09:11 +00:00
Daniel Stenberg
32c03eadd6
glibc 2.2.93 gethostbyname_r() no longer returns ERANGE if the given buffer
...
size isn't big enough. For some reason they now return EAGAIN.
Redhat 8 ships with this glibc version.
2002-10-21 13:20:30 +00:00
Daniel Stenberg
84fa12c885
Cris Bailiff found this flaw, gethostbyname_r() on linux returns 0 even
...
when it can't lookup the name (at least in some cases) and thus we need
to make an extra check to detect failures.
2002-09-30 08:07:16 +00:00
Daniel Stenberg
ba4e69bebc
updated source code boilerplate/header
2002-09-03 11:52:59 +00:00
Daniel Stenberg
7438c378be
prevent compiler warning
2002-08-30 11:10:50 +00:00
Daniel Stenberg
ca5678c8c1
attempted hpux fix for resolves
2002-08-08 22:44:43 +00:00
Daniel Stenberg
7f8ad34ba2
Glen Nakamura made his fix look even better!
2002-06-26 15:39:23 +00:00
Daniel Stenberg
a33e89b44a
Glen Nakamura's patch for Curl_getaddrinfo().
2002-06-26 08:03:46 +00:00
Daniel Stenberg
3c49b405de
Now uses sigsetjmp() and siglongjmp() to bail out from slow name lookups in
...
case a timeout is set. This seems to work. God knows if it is good enough
or what kind of side-effects we introduce here and now.
I'll close my eyes and cross my fingers. Hard.
2002-06-11 15:10:18 +00:00
Daniel Stenberg
11ba367fc9
getaddrinfo() failures now show port number too in informational output
2002-06-10 13:26:02 +00:00
Daniel Stenberg
0db227f55e
hostcache_fixoffset() is now corrected to work on 64bit architectures
...
Bug report #564585 .
2002-06-05 13:41:33 +00:00
Daniel Stenberg
9263652c6d
Fixes bug report #556930 - we need to make sure that the data is all right
...
after we've realloc() the packed hostent struct.
2002-05-17 07:49:28 +00:00
Daniel Stenberg
b1becd0ed5
Jacky Lam's fix to make the realloc() of the hostent data work properly
...
even when the realloc() actually gets a new memory block
2002-05-01 11:36:13 +00:00
Daniel Stenberg
8358505b6d
Now uses Curl_ as prefix for internal global symbols. curl_ should only be
...
used for "exported" globals.
2002-04-27 13:07:51 +00:00
Daniel Stenberg
8927ddec16
In order to not get problems with DNS cache pruning, we no longer store
...
any name resolved data in any curl handle struct. That way, we won't mind
if the cache entries are pruned for the next time we need them. We'll just
resolve them again instead.
This changes the Curl_resolv() proto. It modifies the SessionHandle struct
but perhaps most importantly, it'll make the internals somewhat dependent
on the DNS cache not being disabled as that will cripple operations somewhat.
Especially for persistant connections.
2002-04-25 19:00:57 +00:00
Daniel Stenberg
db6d4bcf47
the 80 column police narrowed this source code! B-]
2002-04-23 14:56:21 +00:00
Daniel Stenberg
53a9fdf078
use sclose() to close sockets
2002-04-22 23:53:49 +00:00
Daniel Stenberg
21fc402c01
Jacky Lam's adjust resolve-buffer size patch applied. Slightly edited
...
by Daniel.
2002-04-22 13:31:16 +00:00
Daniel Stenberg
381f77756d
pack_hostent does not handle 64 bit pointers correctly.
...
A Bjørn Reese patch.
2002-04-19 11:00:26 +00:00
Sterling Hughes
a386562d9a
Prune old hostcache entries with each call...
...
This can be optimized a tidbit, but this is a start.
2002-04-17 20:13:55 +00:00
Daniel Stenberg
974f314f57
copyright string (year) update
2002-03-19 07:54:55 +00:00
Daniel Stenberg
fb29529a52
Jun-ichiro itojun Hagino <itojun@itojun.org>:
...
Now first check if IPv6 is supported, then use PF_UNSPEC. If not, use PF_INET.
It'll solve both the "slow name lookup" problem on IPv4 and still work fine on
IPv6 hosts.
Bug report #530204 has more details:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=530204&group_id=976
2002-03-15 09:54:30 +00:00
Daniel Stenberg
3cd2673077
bug report #530204 correctly identified that revision 1.52 broke ipv6
...
functionality and this change reverts this.
However, with this revert we bring back problems on (some/all?) non-IPv6
enabled Linux machines that have getaddrinfo().
2002-03-15 08:45:09 +00:00