diff Core/HttpClient.cpp @ 1590:ba0226474e22

New configuration option: "HttpTimeout" to set the default timeout for HTTP requests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Aug 2015 17:51:03 +0200
parents 95b3b0260240
children 31f4adefb88f
line wrap: on
line diff
--- a/Core/HttpClient.cpp	Wed Aug 26 17:43:00 2015 +0200
+++ b/Core/HttpClient.cpp	Wed Aug 26 17:51:03 2015 +0200
@@ -44,6 +44,7 @@
 
 static std::string globalCACertificates_;
 static bool globalVerifyPeers_ = true;
+static long globalTimeout_ = 0;
 
 extern "C"
 {
@@ -140,7 +141,7 @@
     method_ = HttpMethod_Get;
     lastStatus_ = HttpStatus_200_Ok;
     isVerbose_ = false;
-    timeout_ = 0;
+    timeout_ = globalTimeout_;
     verifyPeers_ = globalVerifyPeers_;
   }
 
@@ -384,4 +385,11 @@
   {
     curl_global_cleanup();
   }
+
+  
+  void HttpClient::SetDefaultTimeout(long timeout)
+  {
+    LOG(INFO) << "Setting the default timeout for HTTP client connections: " << timeout << " seconds";
+    globalTimeout_ = timeout;
+  }
 }