From 34fc1a5dfc7c6fe730ec554f9244f1e10a62c60d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 26 Oct 2013 18:33:56 +0200 Subject: set curl connection timeout to 2 seconds --- pacredir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pacredir.c b/pacredir.c index e4ce8ce..a197012 100644 --- a/pacredir.c +++ b/pacredir.c @@ -200,6 +200,9 @@ int get_http_code(const char * host, const uint16_t port, const char * url) { curl_easy_setopt(curl, CURLOPT_USERAGENT, "pacredir/" VERSION); /* do not receive body */ curl_easy_setopt(curl, CURLOPT_NOBODY, 1); + /* set connection timeout to 2 seconds + * if the host needs longer we do not want to use it anyway ;) */ + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 2); /* get it! */ if (curl_easy_perform(curl) != CURLE_OK) { -- cgit v1.2.3-54-g00ecf