changeset 3428:6add197274b1

default value of HttpTimeout is now 60 seconds
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Jun 2019 09:44:45 +0200
parents 3ff4f07806eb
children 954d15f24366
files Core/HttpClient.cpp NEWS OrthancServer/main.cpp
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Core/HttpClient.cpp	Sat Jun 15 18:06:08 2019 +0000
+++ b/Core/HttpClient.cpp	Mon Jun 17 09:44:45 2019 +0200
@@ -46,6 +46,10 @@
 #include <boost/thread/mutex.hpp>
 
 
+// Default timeout = 60 seconds (in Orthanc <= 1.5.6, it was 10 seconds)
+static const unsigned int DEFAULT_HTTP_TIMEOUT = 60;
+
+
 #if ORTHANC_ENABLE_PKCS11 == 1
 #  include "Pkcs11.h"
 #endif
@@ -818,8 +822,8 @@
     // Set timeouts
     if (timeout_ <= 0)
     {
-      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_TIMEOUT, 10));  /* default: 10 seconds */
-      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CONNECTTIMEOUT, 10));  /* default: 10 seconds */
+      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_TIMEOUT, DEFAULT_HTTP_TIMEOUT));
+      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CONNECTTIMEOUT, DEFAULT_HTTP_TIMEOUT));
     }
     else
     {
--- a/NEWS	Sat Jun 15 18:06:08 2019 +0000
+++ b/NEWS	Mon Jun 17 09:44:45 2019 +0200
@@ -24,6 +24,7 @@
 * Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
 * Allow the serialization of signed 16bpp images in PAM format
 * HTTP header "Accept-Encoding" is honored for streams without built-in support for compression
+* The default HTTP timeout is now 60 seconds (instead of 10 seconds in previous versions)
 * Fix issue #136 (C-FIND request fails when found DICOM file does not have certain tags)
 * Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
 * Fix issue #138 (POST to modalities/{name} accepts invalid characters)
--- a/OrthancServer/main.cpp	Sat Jun 15 18:06:08 2019 +0000
+++ b/OrthancServer/main.cpp	Mon Jun 17 09:44:45 2019 +0200
@@ -1117,7 +1117,11 @@
                              lock.GetConfiguration().InterpretStringParameterAsPath
                              (lock.GetConfiguration().GetStringParameter("HttpsCACertificates", "")));
     HttpClient::SetDefaultVerbose(lock.GetConfiguration().GetBooleanParameter("HttpVerbose", false));
+
+    // The value "0" below makes the class HttpClient use its default
+    // value (DEFAULT_HTTP_TIMEOUT = 60 seconds in Orthanc 1.5.7)
     HttpClient::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpTimeout", 0));
+    
     HttpClient::SetDefaultProxy(lock.GetConfiguration().GetStringParameter("HttpProxy", ""));
     
     DicomUserConnection::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScuTimeout", 10));