Skip to content

Commit b04050c

Browse files
committed
HTTPS request timeout optimalization
If we already have a connection 5 second should be enough, else leave time for connecting to server. Goal is to fail faster if some reused HTTPS connection was idle for way too many time and it is actually not working anymore.
1 parent efbb490 commit b04050c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/https_client.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static void https_fetch_ctx_init(https_client_t *client,
319319
ASSERT_CURL_EASY_SETOPT(ctx, CURLOPT_USERAGENT, "https_dns_proxy/0.3");
320320
ASSERT_CURL_EASY_SETOPT(ctx, CURLOPT_FOLLOWLOCATION, 0);
321321
ASSERT_CURL_EASY_SETOPT(ctx, CURLOPT_NOSIGNAL, 0);
322-
ASSERT_CURL_EASY_SETOPT(ctx, CURLOPT_TIMEOUT, 10 /* seconds */);
322+
ASSERT_CURL_EASY_SETOPT(ctx, CURLOPT_TIMEOUT, client->connections > 0 ? 5 : 10 /* seconds */);
323323
// We know Google supports this, so force it.
324324
ASSERT_CURL_EASY_SETOPT(ctx, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
325325
ASSERT_CURL_EASY_SETOPT(ctx, CURLOPT_ERRORBUFFER, ctx->curl_errbuf); // zeroed by calloc

0 commit comments

Comments
 (0)