aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 395055f4e..c89234d74 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -748,6 +748,13 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
set->chunk_bgn = ZERO_NULL;
set->chunk_end = ZERO_NULL;
+ /* tcp keepalives are disabled by default, but provide reasonable values for
+ * the interval and idle times.
+ */
+ set->tcp_keepalive = 0;
+ set->tcp_keepintvl = 60;
+ set->tcp_keepidle = 60;
+
return res;
}
@@ -811,6 +818,7 @@ CURLcode Curl_open(struct SessionHandle **curl)
multi stack. */
}
+
if(res) {
Curl_resolver_cleanup(data->state.resolver);
if(data->state.headerbuff)
@@ -2545,6 +2553,16 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
result = Curl_set_dns_servers(data, va_arg(param, char *));
break;
+ case CURLOPT_TCP_KEEPALIVE:
+ data->set.tcp_keepalive = (0 != va_arg(param, long))?TRUE:FALSE;
+ break;
+ case CURLOPT_TCP_KEEPIDLE:
+ data->set.tcp_keepidle = va_arg(param, long);
+ break;
+ case CURLOPT_TCP_KEEPINTVL:
+ data->set.tcp_keepintvl = va_arg(param, long);
+ break;
+
default:
/* unknown tag and its companion, just ignore: */
result = CURLE_UNKNOWN_OPTION;