From f67009dd980d370f0518a923ba17947fe452451d Mon Sep 17 00:00:00 2001 From: Cliff Crosland Date: Tue, 11 Jun 2019 14:17:30 -0700 Subject: [PATCH] url: Fix CURLOPT_MAXAGE_CONN time comparison Old connections are meant to expire from the connection cache after CURLOPT_MAXAGE_CONN seconds. However, they actually expire after 1000x that value. This occurs because a time value measured in milliseconds is accidentally divided by 1M instead of by 1,000. Closes https://github.com/curl/curl/pull/4013 --- lib/url.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/url.c b/lib/url.c index c37ce04947c010..bf1c7c9eacd847 100644 --- a/lib/url.c +++ b/lib/url.c @@ -975,7 +975,7 @@ static bool conn_maxage(struct Curl_easy *data, timediff_t idletime = Curl_timediff(now, conn->lastused); idletime /= 1000; /* integer seconds is fine */ - if(idletime/1000 > data->set.maxage_conn) { + if(idletime > data->set.maxage_conn) { infof(data, "Too old connection (%ld seconds), disconnect it\n", idletime); return TRUE;