changeset 7105:514fc4880d6a

fix handling of zero "HttpTimeout"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Aug 2026 17:42:47 +0200
parents ec5d834c67f2
children c82f58d4e1e4
files NEWS OrthancFramework/Sources/HttpClient.cpp OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h OrthancServer/Resources/Configuration.json
diffstat 4 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Aug 13 16:53:51 2026 +0200
+++ b/NEWS	Thu Aug 13 17:42:47 2026 +0200
@@ -104,9 +104,7 @@
   - When Orthanc was requested to return a private tag in a C-FIND query, it did not return resources that
     did not contain the private tag, even though the tag was not used as a filter in the query. Resources
     without the private tag are now correctly returned in the response.
-* Fix mismatches between the configuration default values and the documentation:
-  - "HttpTimeout" was documented as 60 while its default value is 0 (no timeout)
-  - "Name" was documented as "MyOrthanc" while its default value is "ORTHANC"
+* Fix mismatches between the default values and the documentation for options "HttpTimeout" and "Name"
 * Orthanc no longer accepts DICOM association from modalities whose AET contains invalid characters
 * Orthanc now ignores leading/trailing spaces in AET
 * The configuration options "LoaderThreads" and "ZipLoaderThreads" have been removed from
--- a/OrthancFramework/Sources/HttpClient.cpp	Thu Aug 13 16:53:51 2026 +0200
+++ b/OrthancFramework/Sources/HttpClient.cpp	Thu Aug 13 17:42:47 2026 +0200
@@ -467,7 +467,7 @@
 
     GlobalParameters() : 
       httpsVerifyPeers_(true),
-      timeout_(0),
+      timeout_(DEFAULT_HTTP_TIMEOUT),
       verbose_(false)
     {
     }
@@ -851,7 +851,8 @@
   bool HttpClient::ApplyInternal(CurlAnswer& answer)
   {
     CLOG(INFO, HTTP) << "New HTTP request to: " << url_ << " (timeout: "
-                     << boost::lexical_cast<std::string>(timeout_ <= 0 ? DEFAULT_HTTP_TIMEOUT : timeout_) << "s)";
+                     << (timeout_ <= 0 ? "no timeout" : boost::lexical_cast<std::string>(timeout_) + "s")
+                     << ")";
     
     CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_URL, url_.c_str()));
     CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_HEADERDATA, &answer));
@@ -954,8 +955,9 @@
     // Set timeouts
     if (timeout_ <= 0)
     {
-      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_TIMEOUT, DEFAULT_HTTP_TIMEOUT));
-      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CONNECTTIMEOUT, DEFAULT_HTTP_TIMEOUT));
+      // "0 (zero) which means it never times out during transfer."
+      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_TIMEOUT, 0));
+      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CONNECTTIMEOUT, 0));
     }
     else
     {
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Thu Aug 13 16:53:51 2026 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Thu Aug 13 17:42:47 2026 +0200
@@ -11208,9 +11208,9 @@
    *
    * This function releases the resources allocated to store the name
    * of the current thread, after a call to
-   * "OrthancPluginSetCurrentThreadName()". This function must only be
-   * called from threads that the plugin has created itself when the
-   * thread is reaching its end of life.
+   * OrthancPluginSetCurrentThreadName(). This function must only be
+   * called by threads created by the plugin itself, when they are
+   * reaching the end of their lifetime.
    *
    * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
    * @return 0 if success, other value if error.
--- a/OrthancServer/Resources/Configuration.json	Thu Aug 13 16:53:51 2026 +0200
+++ b/OrthancServer/Resources/Configuration.json	Thu Aug 13 17:42:47 2026 +0200
@@ -10,7 +10,7 @@
 
   // The logical name of this instance of Orthanc. This one is
   // displayed in Orthanc Explorer and at the URI "/system".
-  "Name" : "ORTHANC",
+  "Name" : "MyOrthanc",
 
   // Path to the directory that holds the heavyweight files (i.e. the
   // raw DICOM instances). Backslashes must be either escaped by
@@ -541,7 +541,7 @@
 
   // Set the timeout for HTTP requests issued by Orthanc (in seconds).
   // 0 means no timeout.
-  "HttpTimeout" : 0,
+  "HttpTimeout" : 60,
 
   // Enable the verification of the peers certificates during HTTPS
   // requests. Setting this option to "false" is equivalent to the