Commit Graph

78 Commits

Author SHA1 Message Date
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