1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-08 18:45:05 -05:00
Commit Graph

238 Commits

Author SHA1 Message Date
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
Daniel Stenberg
721b05e343 Nico Baggus' VMS tweaks 2002-02-20 13:46:53 +00:00
Daniel Stenberg
3d5732d4e0 Rick Richardson's getaddrinfo() usage fix to speed up name resolves 2002-02-18 23:12:37 +00:00
Daniel Stenberg
b795929858 INADDR_NONE should be in_addr_t to work with 64bit archs better.
Really, we should only #define this in one file, not both here and in
connect.c!
2002-02-18 22:59:26 +00:00
Daniel Stenberg
3474ec4ecb _num_chars did wrong when called with a number that starts with 1! 2002-01-31 07:51:06 +00:00
Daniel Stenberg
6212e6990a someone should have me punished, but this bug made curl bug seriously
on IPv4-linux machines
2002-01-28 19:23:18 +00:00
Daniel Stenberg
e74b20926d prevents gcc -Wcast-align from complaining 2002-01-18 12:59:33 +00:00
Daniel Stenberg
edcbf4350b include our own sprintf() prototype to make it return sensible data on
all platforms, I also edited a few data types slightly to prevent my
compiler from warning on comparisions between signed and unsigned values
2002-01-17 08:03:48 +00:00
Sterling Hughes
9289ea471f Get this working, still need to check for leaks and such, but should be
fine..
2002-01-17 07:38:25 +00:00
Sterling Hughes
7d06185aa6 Make the keys for hostcache entries be in the format::
host:port, so accessing curl.haxx.se on port 80 would yield a key value
of ::
curl.haxx.se:80
2002-01-17 06:55:37 +00:00
Daniel Stenberg
fefc7ea600 a memory leak when name lookup failed is now removed 2002-01-14 23:14:24 +00:00
Daniel Stenberg
75bba0da92 added two typecasts to prevent compiler (gcc3) warnings 2002-01-08 07:06:07 +00:00
Sterling Hughes
c0bfe7be15 1) the dns_cache_timeout should be an integer, not a bool
2) in the curl_dns_cache_entry structure, timestamp should be
a time_t instead of an integer (although I doubt it matters).
2002-01-08 04:30:59 +00:00
Sterling Hughes
22ac08e06d Add support for DNS cache timeouts via the CURLOPT_DNS_CACHE_TIMEOUT option.
The default cache timeout for this is 60 seconds, which is arbitrary and
completely subject to change :)
2002-01-08 04:26:47 +00:00
Sterling Hughes
bd878756fc Probably not necessary, but good practice. 2002-01-07 20:55:35 +00:00
Sterling Hughes
8d7f402efb Make cach'ing work with threads now, there are now three cases:
- Use a global dns cache (via setting the tentatively named,
    CURLOPT_DNS_USE_GLOBAL_CACHE option to true)
    - Use a per-handle dns cache, by default
    - Use a pooled dns cache when in the "multi" interface
2002-01-07 20:52:32 +00:00
Daniel Stenberg
6de7dc5879 Sterling Hughes' provided initial DNS cache source code. 2002-01-03 10:22:59 +00:00
Daniel Stenberg
fe37fb5921 Philip Gladstone's 64-bit sparc native compiler compatibility issues fixed. 2002-01-02 10:06:47 +00:00
Daniel Stenberg
436d147925 Eric's #include fixes for better macos compiles 2001-12-04 13:03:08 +00:00
Daniel Stenberg
4e276b1b68 pack_hostent() now aligns the data properly on 64bit boundaries to work on
more CPU architectures
2001-10-23 12:11:43 +00:00
Daniel Stenberg
010044e03c the malloc debug system only logs data if the logfile FILE * is set, which
makes it easier to disable debug output when built with debug functions
2001-10-17 12:33:35 +00:00
Sterling Hughes
8e91d5de8e looks nicer and is better compatible with older vim versions 2001-10-11 09:32:19 +00:00
Daniel Stenberg
47def8091c made sure the correct pieces of code are compiled on IPv4-only hosts, and
the pack_hostent() is only compiled if gethostbyname_r() isn't present.
2001-10-04 13:36:11 +00:00
Daniel Stenberg
5d9ae88f58 getaddrinfo() cleanups 2001-10-04 13:25:12 +00:00
Daniel Stenberg
9d066935e5 Keith McGuigan's excellent fix that makes a cloned copy of the hostent struct
for when gethostbyname() is used so that we have the memory of the struct
allocated. This turns out to be needed if the curl handled is passed between
threads on Windows and possibly other operating systems where we use that
function.
2001-10-03 21:42:04 +00:00
Daniel Stenberg
4d13b2cc64 more ipv6 cleanups to make smaller functions that are easier to read 2001-09-28 07:46:39 +00:00
Daniel Stenberg
48dc74aecc more transparant support for IPv6 name resolving 2001-09-28 07:05:26 +00:00
Daniel Stenberg
36e9507e29 reverted. twas no memory leak and the "fix" didn't even compile on windows... 2001-09-12 08:59:00 +00:00
Daniel Stenberg
8950a2dfa1 *TERRIBLE* terrible memory leak occuring on all systems that have no
gethostbyname_r() function, most notably windows machines...
2001-09-12 07:19:11 +00:00
Sterling Hughes
6147879837 Added formatting sections for emacs and vim 2001-09-07 04:01:32 +00:00
Daniel Stenberg
0ece1b5c34 Major rename and redesign of the internal "backbone" structs. Details will
be posted in a minute to the libcurl list.
2001-08-30 22:48:34 +00:00
Daniel Stenberg
93bcfd4e65 Nico Baggus' VMS adjustments 2001-08-06 12:19:26 +00:00
Daniel Stenberg
d9f39cc99b finally fixed the 'ret' compiler warning 2001-05-30 11:06:33 +00:00
Daniel Stenberg
f6e2bfd464 Jun-ichiro itojun Hagino's IPv6 adjustments 2001-02-05 23:04:44 +00:00
Daniel Stenberg
4031104404 Internal symbols that aren't static are now prefixed with 'Curl_' 2001-01-05 10:11:41 +00:00
Daniel Stenberg
24dee483e9 dual-license fix 2001-01-03 09:29:33 +00:00
Daniel Stenberg
c06f726614 GetHost() now sets the third pointer to NULL when the lookup fails, as the
memory is then freed in the function
2000-11-21 15:35:45 +00:00
Daniel Stenberg
336b0b7d82 added comment on a variable that is unused on some platforms 2000-11-21 09:29:21 +00:00
Daniel Stenberg
0f8facb49b added memory debugging include file 2000-10-09 11:12:34 +00:00
Daniel Stenberg
1e2e6a4e33 GetHost() did not properly assign the third argument pointer! 2000-10-08 12:50:51 +00:00
Daniel Stenberg
e372a440c0 #include <malloc.h> was removed, it causes warnings on openbsd 2000-09-29 06:34:50 +00:00
Daniel Stenberg
aa8a2fbde3 GetHost() changed function arguments 2000-09-21 08:47:48 +00:00
Daniel Stenberg
398e3f423f GetHost() now should return NULL when it fails, even for Tru64 unix 2000-09-18 21:16:27 +00:00
Daniel Stenberg
b6e18f2f66 #include "setup.h" moved first of all includes 2000-08-24 14:26:33 +00:00
Daniel Stenberg
1b1f143cd6 hostname and large file support added 2000-08-24 12:33:16 +00:00
Daniel Stenberg
d4731b7050 Albert Chin-A-Young's fixes 2000-08-23 07:23:42 +00:00
Daniel Stenberg
a8f99e7924 the gethostbyname_r() usage was improved by Fred Noz 2000-08-17 21:07:22 +00:00
Daniel Stenberg
02f994a715 Fixed to use the new HAVE_GETHOSTBYxxxx_R_x defines, now trying to support
the AIX-style as well. The AIX-stuff is *NOT* verified to work.
2000-08-04 11:27:17 +00:00
Daniel Stenberg
1ef3600a07 haxx.nu => haxx.se 2000-06-20 15:31:26 +00:00
Daniel Stenberg
980ee98ec9 David LeBlanc corrected one of my mistakes 2000-05-31 06:31:31 +00:00
Daniel Stenberg
8d76ad6c8e Adjusted to the GETHOSTBYADDR_R_NARGS style 2000-05-30 22:27:39 +00:00
Daniel Stenberg
a0ce95e155 David LeBlanc's fixes! 2000-05-29 22:51:13 +00:00
Daniel Stenberg
ae1912cb0d Initial revision 1999-12-29 14:20:26 +00:00