Changelog
+Daniel (17 February 2006)
+- 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.
+
Daniel (11 February 2006)
-- Karl M added the CURLOPT_CONNECT_ONLY and CURLINFO_LASTSOCKET options that
- an app can use to let libcurl only connect to a remote host and then extract
- the socket from libcurl. libcurl will then not attempt to do any transfer at
- all after the connect is done.
+- Karl Moerder added the CURLOPT_CONNECT_ONLY and CURLINFO_LASTSOCKET options
+ that an app can use to let libcurl only connect to a remote host and then
+ extract the socket from libcurl. libcurl will then not attempt to do any
+ transfer at all after the connect is done.
- Kent Boortz improved the configure check for GnuTLS to properly set LIBS
instead of LDFLAGS.
This release includes the following bugfixes:
+ o cached DNS entries could remain in the cache too long
o improved GnuTLS check in configure
o re-used FTP connections when the second request didn't do a transfer
o plain --limit-rate [num] means bytes
Dov Murik, Jean Jacques Drouin, Andres Garcia, Yang Tse, Gisle Vanem, Dan
Fandrich, Alexander Lazic, Michael Jahn, Andrew Benham, Bryan Henderson,
David Shaw, Jon Turner, Duane Cathey, Michal Marek, Philippe Vaucher, Kent
- Boortz, Karl M
+ Boortz, Karl Moerder, Shmulik Regev
Thanks! (and sorry if I forgot to mention someone)
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
}
+static int
+remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)
+{
+ struct hostcache_prune_data user;
+
+ if( !dns || (data->set.dns_cache_timeout == -1) || !data->hostcache)
+ /* cache forever means never prune, and NULL hostcache means
+ we can't do it */
+ return 0;
+
+ time(&user.now);
+ user.cache_timeout = data->set.dns_cache_timeout;
+
+ if ( !hostcache_timestamp_remove(&user,dns) )
+ return 0;
+
+ /* ok, we do need to clear the cache. although we need to remove just a
+ single entry we clean the entire hash, as no explicit delete function
+ is provided */
+ if(data->share)
+ Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
+
+ Curl_hash_clean_with_criterium(data->hostcache,
+ (void *) &user,
+ hostcache_timestamp_remove);
+
+ if(data->share)
+ Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
+
+ return 1;
+}
+
+
#ifdef HAVE_SIGSETJMP
/* Beware this is a global and unique instance. This is used to store the
return address that we can jump back to from inside a signal handler. This
/* free the allocated entry_id again */
free(entry_id);
+ /* See whether the returned entry is stale. Deliberately done after the
+ locked block */
+ if ( remove_entry_if_stale(data,dns) )
+ dns = NULL; /* the memory deallocation is being handled by the hash */
+
rc = CURLRESOLV_ERROR; /* default to failure */
if (!dns) {