changeset 237:78f0557d70ee

Sending "HttpHeaders" of the "DicomWeb.Servers" configuration to remote DICOMweb servers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 07 Nov 2018 14:46:43 +0100
parents 15273c57e936
children 11d05a138412
files NEWS Plugin/DicomWebServers.cpp
diffstat 2 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Sep 04 09:58:35 2018 +0200
+++ b/NEWS	Wed Nov 07 14:46:43 2018 +0100
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* Sending "HttpHeaders" of the "DicomWeb.Servers" configuration to remote DICOMweb servers
+
 
 Version 0.5 (2018-04-19)
 ========================
--- a/Plugin/DicomWebServers.cpp	Tue Sep 04 09:58:35 2018 +0200
+++ b/Plugin/DicomWebServers.cpp	Wed Nov 07 14:46:43 2018 +0100
@@ -154,18 +154,32 @@
       url += uri;
     }
 
-    std::vector<const char*> httpHeadersKeys(httpHeaders.size());
-    std::vector<const char*> httpHeadersValues(httpHeaders.size());
+    std::map<std::string, std::string> allHttpHeaders = server.GetHttpHeaders();
+    
+    {
+      // Add the user-specified HTTP headers to the HTTP headers
+      // coming from the Orthanc configuration file
+      for (std::map<std::string, std::string>::const_iterator
+             it = httpHeaders.begin(); it != httpHeaders.end(); ++it)
+      {
+        allHttpHeaders[it->first] = it->second;
+      }
+    }
+
+    std::vector<const char*> httpHeadersKeys(allHttpHeaders.size());
+    std::vector<const char*> httpHeadersValues(allHttpHeaders.size());
 
     {
       size_t pos = 0;
       for (std::map<std::string, std::string>::const_iterator
-             it = httpHeaders.begin(); it != httpHeaders.end(); ++it)
+             it = allHttpHeaders.begin(); it != allHttpHeaders.end(); ++it)
       {
         httpHeadersKeys[pos] = it->first.c_str();
         httpHeadersValues[pos] = it->second.c_str();
         pos += 1;
       }
+
+      assert(pos == allHttpHeaders.size());
     }
 
     const char* bodyContent = NULL;
@@ -190,7 +204,7 @@
       method,
       url.c_str(), 
       /* HTTP headers*/
-      httpHeaders.size(),
+      allHttpHeaders.size(),
       httpHeadersKeys.empty() ? NULL : &httpHeadersKeys[0],
       httpHeadersValues.empty() ? NULL : &httpHeadersValues[0],
       bodyContent, bodySize,