Commit Graph

338 Commits

Author SHA1 Message Date
Daniel Stenberg 56f17d2c9f I made the torture test on test 530 go through. This was actually due to
silly code left from when we switched to let the multi handle "hold" the dns
cache when using the multi interface... Of course this only triggered when a
certain function call returned error at the correct moment.
2008-01-15 22:15:55 +00:00
Daniel Stenberg cbd1a77ec2 if () => if()
while () => while()
and some other minor re-indentings
2007-11-07 09:21:35 +00:00
Dan Fandrich 8388366849 Renamed a variable to avoid shadowing a global declarations. 2007-09-28 18:47:59 +00:00
Dan Fandrich 523767660c Fixed some minor mismatched types found by splint. 2007-08-26 05:53:26 +00:00
Daniel Stenberg 54967d2a3a Thomas J. Moore provided a patch that introduces Kerberos5 support in
libcurl. This also makes the options change name to --krb (from --krb4) and
CURLOPT_KRBLEVEL (from CURLOPT_KRB4LEVEL) but the old names are still
2007-07-01 22:01:18 +00:00
Daniel Stenberg 62f0f5571d Robert Iakobashvili re-arranged the internal hash code to work with a custom
hash function for different hashes, and also expanded the default size for
the socket hash table used in multi handles to greatly enhance speed when
very many connections are added and the socket API is used.
2007-06-26 21:09:28 +00:00
Yang Tse 94b253fde7 Steve Little's fixes to allow compilation on VMS 64-bit mode 2007-04-25 03:00:10 +00:00
Gisle Vanem c514a2a89a Removed inclusion of <sys/types.h> and <sys/stat.h> in .c-files
since they're already included through "setup.h".
2007-02-26 04:24:26 +00:00
Yang Tse 3a634a273a curlassert macro replaced with DEBUGASSERT macro defined in setup_once.h 2007-02-21 19:03:20 +00:00
Dan Fandrich 77516822f6 Workaround for Cray UNICOS 9.0 to fix ftp. 2006-08-21 22:28:19 +00:00
Dan Fandrich 839441e236 Minor portability fixes to get things running on UNICOS 9.0 on a Cray Y-MP 2006-08-16 18:48:27 +00:00
Yang Tse ecfaa4f869 Fix warning: no newline at end of file 2006-07-25 18:48:12 +00:00
Yang Tse 13616f8f96 Simplify check for NEED_MALLOC_H, and make more explicit that NEED_MALLOC_H shall be defined if <malloc.h> header file must be included even when including <stdlib.h>. 2006-07-25 13:49:49 +00:00
Gisle Vanem e4d6ade4b3 Moved functions common to IPv4 and C-ares to hostip.c;
Curl_freeaddrinfo() and Curl_ip2addr().
2006-07-25 10:31:31 +00:00
Gisle Vanem c82e880f5b Remove comment about c-ares not supporting IPv6. 2006-07-25 10:23:15 +00:00
Gisle Vanem 5cdbd0cf4a Constify arguments to Curl_he2ai() and Curl_addrinfo_copy(). 2006-07-21 06:21:46 +00:00
Gisle Vanem a55c70d4ae Constify 'hostname' and 'service' to various resolver functions. 2006-07-21 05:51:12 +00:00
Yang Tse fe22872d14 include <malloc.h> only if HAVE_MALLOC_H and NEED_MALLOC_H are both defined. 2006-07-11 21:34:23 +00:00
Daniel Stenberg ca319f63ad Ingmar Runge provided a source snippet that caused a crash. The reason for
the crash was that libcurl internally was a bit confused about who owned the
DNS cache at all times so if you created an easy handle that uses a shared
DNS cache and added that to a multi handle it would crash. Now we keep more
careful internal track of exactly what kind of DNS cache each easy handle
uses: None, Private (allocated for and used only by this single handle),
Shared (points to a cache held by a shared object), Global (points to the
global cache) or Multi (points to the cache within the multi handle that is
automatically shared between all easy handles that are added with private
caches).
2006-07-07 22:58:06 +00:00
Daniel Stenberg e85e30546c Roland Blom filed bug report #1481217
(http://curl.haxx.se/bug/view.cgi?id=1481217), with follow-ups by Michele Bini
and David Byron. libcurl previously wrongly used GetLastError() on windows to
get error details after socket-related function calls, when it really should
use WSAGetLastError() instead.

When changing to this, the former function Curl_ourerrno() is now instead
called Curl_sockerrno() as it is necessary to only use it to get errno from
socket-related functions as otherwise it won't work as intended on Windows.
2006-05-04 22:39:47 +00:00
Gisle Vanem 3cbb1b2b64 Use the HAVE_MALLOC_H and HAVE_PROCESS_H defines
(more logical).
2006-04-26 17:23:28 +00:00
Daniel Stenberg 92009181af Shmulik Regev provided a fix for the DNS cache when using short life times,
as previously it could be holding on to old cached entries longer than
requested.
2006-02-16 23:42:32 +00:00
Daniel Stenberg 5f0366c2cb only define _REENTRANT if not already defined, and only in setup.h 2005-04-19 23:19:23 +00:00
Daniel Stenberg 6a2e21ec8c FTP code turned into state machine. Not completely yet, but a good start.
The tag 'before_ftp_statemachine' was set just before this commit in case
of future need.
2005-02-09 13:06:40 +00:00
Daniel Stenberg 043d70fcdf Use plain structs and not typedef'ed ones in the hash and linked-list code. 2005-01-25 00:06:29 +00:00
Daniel Stenberg dcea109bb5 Dan Fandrich fix: eliminates some pedantic CodeWarrior compiler warnings and
errors.
2004-11-18 14:04:40 +00:00
Daniel Stenberg 6d1b37b3da Prevent a longjmp warning by moving the rc assign within Curl_resolv().
Andy Cedilnik reported. Warning on HP-UX?
2004-10-10 03:32:01 +00:00
Daniel Stenberg 39af394a1c removed tabs and trailing whitespace from source 2004-10-06 07:50:18 +00:00
Daniel Stenberg 95def48071 Made the dns entry remain locked while a connection to the host remains to
allow verbose output during this period. Bertrand Demiddelaer reported and
helped fixing.
2004-10-04 10:36:51 +00:00
Daniel Stenberg f2a99d7d74 the _num_chars() function is not used, removing 2004-06-24 15:05:39 +00:00
Daniel Stenberg feb2dd2835 Replaced all uses of sprintf() with the safer snprintf(). It is just a
precaution to prevent mistakes to lead to buffer overflows.
2004-06-24 11:54:11 +00:00
Daniel Stenberg 5e34f3dc01 made the Curl_he2ai() take the port number as an int intead, to avoid lots
of typecasts all over
2004-06-24 10:43:50 +00:00
Daniel Stenberg 560c257bd0 prevent warning 2004-06-24 08:08:28 +00:00
Daniel Stenberg c39858aac0 Source cleanups. The major one being that we now _always_ use a Curl_addrinfo
linked list for name resolved data, even on hosts/systems with only IPv4
stacks as this simplifies a lot of code.
2004-06-24 07:43:48 +00:00
Daniel Stenberg 8d76d4016d removed trailing whitespace 2004-06-10 11:56:02 +00:00
Daniel Stenberg 9f92657f76 Gisle corrected two comments 2004-06-10 11:55:37 +00:00
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 Gnter 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 Bjrn 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