aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorSterling Hughes <sterling@bumblebury.com>2002-01-08 04:26:47 +0000
committerSterling Hughes <sterling@bumblebury.com>2002-01-08 04:26:47 +0000
commit22ac08e06db32cb2a7872316a669eb81ec3ea204 (patch)
tree1afa025886527ee24580723104e03357931cc786 /lib/url.c
parent87037136efd4d5eeefb7456c2ad14740a956e47d (diff)
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 :)
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/url.c b/lib/url.c
index 56e7fa73f..63d9ae56a 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -251,13 +251,15 @@ CURLcode Curl_open(struct SessionHandle **curl)
data->set.httpreq = HTTPREQ_GET; /* Default HTTP request */
data->set.ftp_use_epsv = TRUE; /* FTP defaults to EPSV operations */
+ data->set.dns_cache_timeout = 60; /* Timeout every 60 seconds by default */
+
/* make libcurl quiet by default: */
data->set.hide_progress = TRUE; /* CURLOPT_NOPROGRESS changes these */
data->progress.flags |= PGRS_HIDE;
/* Set the default size of the SSL session ID cache */
data->set.ssl.numsessions = 5;
-
+
/* create an array with connection data struct pointers */
data->state.numconnects = 5; /* hard-coded right now */
data->state.connects = (struct connectdata **)
@@ -284,7 +286,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
va_start(param, option);
switch(option) {
- case CURLOPT_DNS_USE_GLOBAL_CACHE: {
+ case CURLOPT_DNS_CACHE_TIMEOUT:
+ data->set.dns_cache_timeout = va_arg(param, int);
+ break;
+ case CURLOPT_DNS_USE_GLOBAL_CACHE:
+ {
int use_cache = va_arg(param, int);
if (use_cache) {
Curl_global_host_cache_init();