changeset 90:a54260a7fe59

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2015 13:54:33 +0100
parents bc05500ea317
children 7c71ad2210c0 12ce166b33d5
files NEWS Orthanc/Core/Enumerations.cpp Orthanc/Core/Enumerations.h Orthanc/Core/Toolbox.cpp Orthanc/Core/Toolbox.h Orthanc/Resources/CMake/BoostConfiguration.cmake
diffstat 6 files changed, 67 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Nov 09 09:34:49 2015 +0100
+++ b/NEWS	Fri Nov 27 13:54:33 2015 +0100
@@ -8,6 +8,7 @@
 * Fix for old versions of jQuery
 * Fix possible deadlock with other plugins in OnChangeCallback()
 * Upgrade to GDCM 2.6.0 for static builds
+* Upgrade to Boost 1.59.0 for static builds
 
 
 Version 1.2 (2015-08-02)
--- a/Orthanc/Core/Enumerations.cpp	Mon Nov 09 09:34:49 2015 +0100
+++ b/Orthanc/Core/Enumerations.cpp	Fri Nov 27 13:54:33 2015 +0100
@@ -151,6 +151,9 @@
       case ErrorCode_EmptyRequest:
         return "The request is empty";
 
+      case ErrorCode_NotAcceptable:
+        return "Cannot send a response which is acceptable according to the Accept HTTP header";
+
       case ErrorCode_SQLiteNotOpened:
         return "SQLite: The database is not opened";
 
@@ -322,6 +325,9 @@
       case ErrorCode_CannotOrderSlices:
         return "Unable to order the slices of the series";
 
+      case ErrorCode_NoWorklistHandler:
+        return "No request handler factory for DICOM C-Find Modality SCP";
+
       default:
         if (error >= ErrorCode_START_PLUGINS)
         {
@@ -675,8 +681,8 @@
       case RequestOrigin_DicomProtocol:
         return "DicomProtocol";
 
-      case RequestOrigin_Http:
-        return "Http";
+      case RequestOrigin_RestApi:
+        return "RestApi";
 
       case RequestOrigin_Plugins:
         return "Plugins";
@@ -980,39 +986,6 @@
   }
 
 
-  const char* GetMimeType(FileContentType type)
-  {
-    switch (type)
-    {
-      case FileContentType_Dicom:
-        return "application/dicom";
-
-      case FileContentType_DicomAsJson:
-        return "application/json";
-
-      default:
-        return "application/octet-stream";
-    }
-  }
-
-
-  const char* GetFileExtension(FileContentType type)
-  {
-    switch (type)
-    {
-      case FileContentType_Dicom:
-        return ".dcm";
-
-      case FileContentType_DicomAsJson:
-        return ".json";
-
-      default:
-        // Unknown file type
-        return "";
-    }
-  }
-
-
   ResourceType GetChildResourceType(ResourceType type)
   {
     switch (type)
@@ -1164,8 +1137,18 @@
       case ErrorCode_Unauthorized:
         return HttpStatus_401_Unauthorized;
 
+      case ErrorCode_NotAcceptable:
+        return HttpStatus_406_NotAcceptable;
+
       default:
         return HttpStatus_500_InternalServerError;
     }
   }
+
+
+  bool IsUserContentType(FileContentType type)
+  {
+    return (type >= FileContentType_StartUser &&
+            type <= FileContentType_EndUser);
+  }
 }
--- a/Orthanc/Core/Enumerations.h	Mon Nov 09 09:34:49 2015 +0100
+++ b/Orthanc/Core/Enumerations.h	Fri Nov 27 13:54:33 2015 +0100
@@ -80,6 +80,7 @@
     ErrorCode_DatabasePlugin = 31    /*!< The plugin implementing a custom database back-end does not fulfill the proper interface */,
     ErrorCode_StorageAreaPlugin = 32    /*!< Error in the plugin implementing a custom storage area */,
     ErrorCode_EmptyRequest = 33    /*!< The request is empty */,
+    ErrorCode_NotAcceptable = 34    /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
     ErrorCode_SQLiteNotOpened = 1000    /*!< SQLite: The database is not opened */,
     ErrorCode_SQLiteAlreadyOpened = 1001    /*!< SQLite: Connection is already open */,
     ErrorCode_SQLiteCannotOpen = 1002    /*!< SQLite: Unable to open the database */,
@@ -137,6 +138,7 @@
     ErrorCode_DatabaseNotInitialized = 2038    /*!< Plugin trying to call the database during its initialization */,
     ErrorCode_SslDisabled = 2039    /*!< Orthanc has been built without SSL support */,
     ErrorCode_CannotOrderSlices = 2040    /*!< Unable to order the slices of the series */,
+    ErrorCode_NoWorklistHandler = 2041    /*!< No request handler factory for DICOM C-Find Modality SCP */,
     ErrorCode_START_PLUGINS = 1000000
   };
 
@@ -368,7 +370,7 @@
   {
     RequestOrigin_Unknown,
     RequestOrigin_DicomProtocol,
-    RequestOrigin_Http,
+    RequestOrigin_RestApi,
     RequestOrigin_Plugins,
     RequestOrigin_Lua
   };
@@ -454,10 +456,6 @@
   bool GetDicomEncoding(Encoding& encoding,
                         const char* specificCharacterSet);
 
-  const char* GetMimeType(FileContentType type);
-
-  const char* GetFileExtension(FileContentType type);
-
   ResourceType GetChildResourceType(ResourceType type);
 
   ResourceType GetParentResourceType(ResourceType type);
@@ -467,4 +465,6 @@
   const char* GetDicomSpecificCharacterSet(Encoding encoding);
 
   HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error);
+
+  bool IsUserContentType(FileContentType type);
 }
--- a/Orthanc/Core/Toolbox.cpp	Mon Nov 09 09:34:49 2015 +0100
+++ b/Orthanc/Core/Toolbox.cpp	Fri Nov 27 13:54:33 2015 +0100
@@ -494,16 +494,16 @@
 
   void Toolbox::ComputeMD5(std::string& result,
                            const void* data,
-                           size_t length)
+                           size_t size)
   {
     md5_state_s state;
     md5_init(&state);
 
-    if (length > 0)
+    if (size > 0)
     {
       md5_append(&state, 
                  reinterpret_cast<const md5_byte_t*>(data), 
-                 static_cast<int>(length));
+                 static_cast<int>(size));
     }
 
     md5_byte_t actualHash[16];
@@ -554,6 +554,14 @@
   }
 #  endif
 
+
+  void Toolbox::EncodeDataUriScheme(std::string& result,
+                                    const std::string& mime,
+                                    const std::string& content)
+  {
+    result = "data:" + mime + ";base64," + base64_encode(content);
+  }
+
 #endif
 
 
@@ -751,14 +759,16 @@
     return result;
   }
 
+
   void Toolbox::ComputeSHA1(std::string& result,
-                            const std::string& data)
+                            const void* data,
+                            size_t size)
   {
     boost::uuids::detail::sha1 sha1;
 
-    if (data.size() > 0)
+    if (size > 0)
     {
-      sha1.process_bytes(&data[0], data.size());
+      sha1.process_bytes(data, size);
     }
 
     unsigned int digest[5];
@@ -777,6 +787,20 @@
             digest[4]);
   }
 
+  void Toolbox::ComputeSHA1(std::string& result,
+                            const std::string& data)
+  {
+    if (data.size() > 0)
+    {
+      ComputeSHA1(result, data.c_str(), data.size());
+    }
+    else
+    {
+      ComputeSHA1(result, NULL, 0);
+    }
+  }
+
+
   bool Toolbox::IsSHA1(const char* str,
                        size_t size)
   {
--- a/Orthanc/Core/Toolbox.h	Mon Nov 09 09:34:49 2015 +0100
+++ b/Orthanc/Core/Toolbox.h	Fri Nov 27 13:54:33 2015 +0100
@@ -100,12 +100,16 @@
 
     void ComputeMD5(std::string& result,
                     const void* data,
-                    size_t length);
+                    size_t size);
 #endif
 
     void ComputeSHA1(std::string& result,
                      const std::string& data);
 
+    void ComputeSHA1(std::string& result,
+                     const void* data,
+                     size_t size);
+
     bool IsSHA1(const char* str,
                 size_t size);
 
@@ -123,6 +127,10 @@
                              std::string& content,
                              const std::string& source);
 #  endif
+
+    void EncodeDataUriScheme(std::string& result,
+                             const std::string& mime,
+                             const std::string& content);
 #endif
 
     std::string GetPathToExecutable();
--- a/Orthanc/Resources/CMake/BoostConfiguration.cmake	Mon Nov 09 09:34:49 2015 +0100
+++ b/Orthanc/Resources/CMake/BoostConfiguration.cmake	Fri Nov 27 13:54:33 2015 +0100
@@ -39,10 +39,10 @@
 
 
 if (BOOST_STATIC)
-  # Parameters for Boost 1.58.0
-  set(BOOST_NAME boost_1_58_0)
-  set(BOOST_BCP_SUFFIX bcpdigest-0.9.2)
-  set(BOOST_MD5 "704b110917cbda903e07cb53934b47ac")
+  # Parameters for Boost 1.59.0
+  set(BOOST_NAME boost_1_59_0)
+  set(BOOST_BCP_SUFFIX bcpdigest-0.9.5)
+  set(BOOST_MD5 "08abb7cdbea0b380f9ab0d5cce476f12")
   set(BOOST_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz")
   set(BOOST_FILESYSTEM_SOURCES_DIR "${BOOST_NAME}/libs/filesystem/src") 
   set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME})