changeset 408:5a3a4a25e568 lua-scripting

reintegration from mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 May 2013 16:51:40 +0200
parents 941ea46e9e26 (current diff) 2d269089078f (diff)
children 63f707278fc8
files
diffstat 144 files changed, 544 insertions(+), 238 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu May 02 16:34:00 2013 +0200
+++ b/CMakeLists.txt	Thu May 02 16:51:40 2013 +0200
@@ -4,7 +4,7 @@
 
 # Version of the build, should always be "mainline" except in release branches
 add_definitions(
-  -DORTHANC_VERSION="0.5.1"
+  -DORTHANC_VERSION="mainline"
   )
 
 # Parameters of the build
@@ -18,6 +18,7 @@
 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log")
 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test (not for Debian sid)")
 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite")
+SET(USE_DYNAMIC_MONGOOSE OFF CACHE BOOL "Use the dynamic version of Mongoose")
 SET(USE_DYNAMIC_LUA OFF CACHE BOOL "Use the dynamic version of Lua")
 SET(DEBIAN_FORCE_HARDENING OFF CACHE BOOL "Force the injection of Debian hardening flags (unrecommended)")
 SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)")
@@ -34,6 +35,7 @@
 # Some basic inclusions
 include(CheckIncludeFiles)
 include(CheckIncludeFileCXX)
+include(CheckLibraryExists)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake)
--- a/Core/Cache/CacheIndex.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Cache/CacheIndex.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Cache/ICachePageProvider.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Cache/ICachePageProvider.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Cache/MemoryCache.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Cache/MemoryCache.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Cache/MemoryCache.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Cache/MemoryCache.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/ChunkedBuffer.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/ChunkedBuffer.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/ChunkedBuffer.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/ChunkedBuffer.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/BufferCompressor.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/BufferCompressor.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/BufferCompressor.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/BufferCompressor.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/HierarchicalZipWriter.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/HierarchicalZipWriter.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/HierarchicalZipWriter.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/HierarchicalZipWriter.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/ZipWriter.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/ZipWriter.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/ZipWriter.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/ZipWriter.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/ZlibCompressor.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/ZlibCompressor.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Compression/ZlibCompressor.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Compression/ZlibCompressor.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomArray.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomArray.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomArray.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomArray.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomElement.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomElement.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomInstanceHasher.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomInstanceHasher.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomInstanceHasher.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomInstanceHasher.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomIntegerPixelAccessor.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomIntegerPixelAccessor.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomIntegerPixelAccessor.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomIntegerPixelAccessor.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomMap.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomMap.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomMap.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomMap.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomNullValue.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomNullValue.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomString.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomString.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomTag.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomTag.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomTag.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomTag.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/DicomFormat/DicomValue.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/DicomFormat/DicomValue.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/Enumerations.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Enumerations.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/CompressedFileStorageAccessor.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/CompressedFileStorageAccessor.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/CompressedFileStorageAccessor.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/CompressedFileStorageAccessor.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/FileInfo.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/FileInfo.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/FileStorage.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/FileStorage.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/FileStorage.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/FileStorage.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/FileStorageAccessor.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/FileStorageAccessor.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/FileStorageAccessor.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/FileStorageAccessor.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/StorageAccessor.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/StorageAccessor.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/FileStorage/StorageAccessor.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/FileStorage/StorageAccessor.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/BufferHttpSender.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/BufferHttpSender.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/EmbeddedResourceHttpHandler.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/EmbeddedResourceHttpHandler.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/EmbeddedResourceHttpHandler.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/EmbeddedResourceHttpHandler.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/FilesystemHttpHandler.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/FilesystemHttpHandler.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/FilesystemHttpHandler.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/FilesystemHttpHandler.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/FilesystemHttpSender.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/FilesystemHttpSender.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/FilesystemHttpSender.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/FilesystemHttpSender.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/HttpFileSender.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/HttpFileSender.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/HttpFileSender.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/HttpFileSender.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/HttpHandler.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/HttpHandler.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/HttpHandler.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/HttpHandler.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/HttpOutput.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/HttpOutput.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/HttpOutput.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/HttpOutput.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/MongooseServer.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/MongooseServer.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/HttpServer/MongooseServer.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/HttpServer/MongooseServer.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/IDynamicObject.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/IDynamicObject.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/MultiThreading/BagOfRunnablesBySteps.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/MultiThreading/BagOfRunnablesBySteps.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/MultiThreading/BagOfRunnablesBySteps.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/MultiThreading/BagOfRunnablesBySteps.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/MultiThreading/IRunnableBySteps.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/MultiThreading/IRunnableBySteps.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/OrthancException.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/OrthancException.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/OrthancException.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/OrthancException.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/PngWriter.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/PngWriter.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/PngWriter.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/PngWriter.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/RestApi/RestApi.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/RestApi/RestApi.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/RestApi/RestApi.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/RestApi/RestApi.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/RestApi/RestApiOutput.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/RestApi/RestApiOutput.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/RestApi/RestApiOutput.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/RestApi/RestApiOutput.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/RestApi/RestApiPath.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/RestApi/RestApiPath.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/RestApi/RestApiPath.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/RestApi/RestApiPath.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Core/SQLite/Connection.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/Connection.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/Connection.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/Connection.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/FunctionContext.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/FunctionContext.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Redistribution and use in source and binary forms, with or without
--- a/Core/SQLite/FunctionContext.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/FunctionContext.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Redistribution and use in source and binary forms, with or without
--- a/Core/SQLite/IScalarFunction.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/IScalarFunction.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Redistribution and use in source and binary forms, with or without
--- a/Core/SQLite/Statement.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/Statement.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/Statement.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/Statement.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/StatementId.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/StatementId.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/StatementId.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/StatementId.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/StatementReference.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/StatementReference.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/StatementReference.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/StatementReference.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/Transaction.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/Transaction.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/SQLite/Transaction.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/SQLite/Transaction.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Copyright (c) 2012 The Chromium Authors. All rights reserved.
--- a/Core/Toolbox.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Toolbox.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
@@ -565,6 +565,33 @@
     }
   }
 
+  bool Toolbox::IsSHA1(const std::string& str)
+  {
+    if (str.size() != 44)
+    {
+      return false;
+    }
+
+    for (unsigned int i = 0; i < 44; i++)
+    {
+      if (i == 8 ||
+          i == 17 ||
+          i == 26 ||
+          i == 35)
+      {
+        if (str[i] != '-')
+          return false;
+      }
+      else
+      {
+        if (!isalnum(str[i]))
+          return false;
+      }
+    }
+
+    return true;
+  }
+
   std::string Toolbox::GetNowIsoString()
   {
     boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
--- a/Core/Toolbox.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Toolbox.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
@@ -80,6 +80,8 @@
     void ComputeSHA1(std::string& result,
                      const std::string& data);
 
+    bool IsSHA1(const std::string& str);
+
     std::string DecodeBase64(const std::string& data);
 
     std::string EncodeBase64(const std::string& data);
--- a/Core/Uuid.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Uuid.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
@@ -96,6 +96,28 @@
     }
 
 
+    bool StartsWithUuid(const std::string& str)
+    {
+      if (str.size() < 36)
+      {
+        return false;
+      }
+
+      if (str.size() == 36)
+      {
+        return IsUuid(str);
+      }
+
+      assert(str.size() > 36);
+      if (!isspace(str[36]))
+      {
+        return false;
+      }
+
+      return IsUuid(str.substr(0, 36));
+    }
+
+
     static std::string CreateTemporaryPath(const char* extension)
     {
 #if BOOST_HAS_FILESYSTEM_V3 == 1
--- a/Core/Uuid.h	Thu May 02 16:34:00 2013 +0200
+++ b/Core/Uuid.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
@@ -51,6 +51,8 @@
 
     bool IsUuid(const std::string& str);
 
+    bool StartsWithUuid(const std::string& str);
+
     class TemporaryFile
     {
     private:
--- a/INSTALL	Thu May 02 16:34:00 2013 +0200
+++ b/INSTALL	Thu May 02 16:51:40 2013 +0200
@@ -69,6 +69,23 @@
 
 
 
+Native Windows build with Microsoft Visual Studio 2005
+------------------------------------------------------
+
+# cd [...]\OrthancBuild
+# cmake -DSTANDALONE_BUILD=ON -G "Visual Studio 8 2005" [...]\Orthanc
+
+Then open the "[...]/OrthancBuild/Orthanc.sln" with Visual Studio.
+
+NOTES:
+* More recent versions of Visual Studio should also work.
+* You will have to install the Platform SDK (version 6 or above) for
+  Visual Studio 2005:
+  http://en.wikipedia.org/wiki/Microsoft_Windows_SDK.
+  Read the CMake FAQ: http://goo.gl/By90B 
+
+
+
 Cross-Compilation for Windows under Linux
 -----------------------------------------
 
@@ -90,36 +107,6 @@
 
 
 
-Native Windows build with Microsoft Visual Studio 2005
-------------------------------------------------------
-
-# cd [...]\OrthancBuild
-# cmake -DSTANDALONE_BUILD=ON -G "Visual Studio 8 2005" [...]\Orthanc
-
-Then open the "[...]/OrthancBuild/Orthanc.sln" with Visual Studio.
-
-NOTES:
-* More recent versions of Visual Studio should also work.
-* You will have to install the Platform SDK (version 6 or above) for
-  Visual Studio 2005:
-  http://en.wikipedia.org/wiki/Microsoft_Windows_SDK.
-  Read the CMake FAQ: http://goo.gl/By90B 
-
-
-
-Debian/Ubuntu specific
-----------------------
-
-When dynamically linking against the system libraries, you have to
-manually add the "wrap" and "oflog" libraries at the configuration
-time (because of a packaging error in "libdcmtk"):
-
-# cd ~/OrthancBuild
-# cmake "-DDCMTK_LIBRARIES=wrap;oflog" -DSTATIC_BUILD=OFF -DCMAKE_BUILD_TYPE=Debug ~/Orthanc
-# make
-
-
-
 Using ccache
 ------------
 
@@ -130,3 +117,10 @@
 # CC="ccache gcc" CXX="ccache g++" cmake "-DDCMTK_LIBRARIES=wrap;oflog" \
   -DSTATIC_BUILD=OFF -DCMAKE_BUILD_TYPE=Debug ~/Orthanc
 
+
+
+Troubleshooting
+---------------
+
+The build instructions for specific Linux distributions are available at the following place:
+https://code.google.com/p/orthanc/wiki/FAQ#I_use_the_Linux_distribution_XXX,_how_can_I_build_Orthanc?
--- a/NEWS	Thu May 02 16:34:00 2013 +0200
+++ b/NEWS	Thu May 02 16:51:40 2013 +0200
@@ -2,6 +2,10 @@
 ===============================
 
 
+* Store-SCU for patients and studies in Orthanc Explorer.
+* "Bulk" Store-SCU (send several DICOM instances with the same
+  DICOM connexion).
+
 
 Version 0.5.1 (2013/04/17)
 ==========================
@@ -9,7 +13,7 @@
 * Support of RGB images
 * Fix of store SCU in release builds
 * Possibility to store the SQLite index at another place than the
-  DICOM instances
+  DICOM instances (for performance)
 
 
 Version 0.5.0 (2013/01/31)
--- a/OrthancCppClient/HttpClient.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancCppClient/HttpClient.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Permission is hereby granted, free of charge, to any person
--- a/OrthancCppClient/HttpClient.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancCppClient/HttpClient.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Permission is hereby granted, free of charge, to any person
--- a/OrthancCppClient/HttpEnumerations.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancCppClient/HttpEnumerations.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Permission is hereby granted, free of charge, to any person
--- a/OrthancCppClient/HttpException.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancCppClient/HttpException.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Permission is hereby granted, free of charge, to any person
--- a/OrthancCppClient/HttpException.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancCppClient/HttpException.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Permission is hereby granted, free of charge, to any person
--- a/OrthancCppClient/main.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancCppClient/main.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * Permission is hereby granted, free of charge, to any person
--- a/OrthancExplorer/explorer.html	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancExplorer/explorer.html	Thu May 02 16:51:40 2013 +0200
@@ -90,6 +90,7 @@
                 </div>
                 <!--a href="#find-patients" data-role="button" data-icon="search">Go to patient finder</a-->
                 <a href="#" data-role="button" data-icon="delete" id="patient-delete">Delete this patient</a>
+                <a href="#" data-role="button" data-icon="forward" id="patient-store">Store in another DICOM modality</a>
                 <a href="#" data-role="button" data-icon="gear" id="patient-archive">Download ZIP</a>
                 <a href="#" data-role="button" data-icon="star" id="patient-anonymize">Anonymize</a>
               </p>
@@ -123,6 +124,7 @@
               </ul>
               <p>
                 <a href="#" data-role="button" data-icon="delete" id="study-delete">Delete this study</a>
+                <a href="#" data-role="button" data-icon="forward" id="study-store">Store in another DICOM modality</a>
                 <a href="#" data-role="button" data-icon="gear" id="study-archive">Download ZIP</a>
                 <a href="#" data-role="button" data-icon="star" id="study-anonymize">Anonymize</a>
               </p>
--- a/OrthancExplorer/explorer.js	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancExplorer/explorer.js	Thu May 02 16:51:40 2013 +0200
@@ -753,7 +753,7 @@
 }
 
 
-$('#instance-store,#series-store').live('click', function(e) {
+$('#instance-store,#series-store,#study-store,#patient-store').live('click', function(e) {
   ChooseDicomModality(function(modality) {
     if (modality != '') {
       $.ajax({
@@ -769,7 +769,6 @@
           $.unblockUI();
         },
         success: function(s) {
-          //console.log('done !');
         },
         error: function() {
           alert('Error during C-Store');
--- a/OrthancServer/DatabaseWrapper.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DatabaseWrapper.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DatabaseWrapper.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DatabaseWrapper.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/DicomFindAnswers.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/DicomFindAnswers.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/DicomFindAnswers.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/DicomFindAnswers.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/DicomServer.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/DicomServer.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/DicomUserConnection.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/IApplicationEntityFilter.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/IApplicationEntityFilter.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/IFindRequestHandler.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/IFindRequestHandler.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/IFindRequestHandlerFactory.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/IFindRequestHandlerFactory.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/IMoveRequestHandler.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/IMoveRequestHandler.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/IMoveRequestHandlerFactory.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/IMoveRequestHandlerFactory.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/IStoreRequestHandler.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/IStoreRequestHandler.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/DicomProtocol/IStoreRequestHandlerFactory.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/DicomProtocol/IStoreRequestHandlerFactory.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/FromDcmtkBridge.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/FromDcmtkBridge.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/FromDcmtkBridge.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/FromDcmtkBridge.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/IServerIndexListener.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/IServerIndexListener.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/CommandDispatcher.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/CommandDispatcher.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/CommandDispatcher.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/CommandDispatcher.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/FindScp.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/FindScp.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/FindScp.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/FindScp.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/MoveScp.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/MoveScp.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/MoveScp.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/MoveScp.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/StoreScp.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/StoreScp.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/Internals/StoreScp.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/Internals/StoreScp.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/OrthancInitialization.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/OrthancInitialization.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/OrthancInitialization.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/OrthancRestApi.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/OrthancRestApi.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
@@ -249,45 +249,69 @@
     RETRIEVE_CONTEXT(call);
 
     std::string remote = call.GetUriComponent("id", "");
+    std::string stripped = Toolbox::StripSpaces(call.GetPostBody());
+
+    Json::Value request;
+    if (Toolbox::IsSHA1(stripped))
+    {
+      // This is for compatibility with Orthanc <= 0.5.1.
+      request = stripped;
+    }
+    else if (!call.ParseJsonRequest(request))
+    {
+      // Bad JSON request
+      return;
+    }
+
+    std::list<std::string> instances;
+    if (request.isString())
+    {
+      LOG(INFO) << "Sending resource " << request.asString() << " to modality " << remote;
+      context.GetIndex().LogExportedResource(request.asString(), remote);
+      context.GetIndex().GetChildInstances(instances, request.asString());
+    }
+    else if (request.isArray())
+    {
+      for (Json::Value::ArrayIndex i = 0; i < request.size(); i++)
+      {
+        if (!request[i].isString())
+        {
+          return;
+        }
+
+        std::string stripped = Toolbox::StripSpaces(request[i].asString());
+        if (!Toolbox::IsSHA1(stripped))
+        {
+          return;
+        }
+
+        LOG(INFO) << "Sending resource " << stripped << " to modality " << remote;
+        context.GetIndex().LogExportedResource(stripped, remote);
+       
+        std::list<std::string> tmp;
+        context.GetIndex().GetChildInstances(tmp, stripped);
+        instances.merge(tmp);
+        assert(tmp.size() == 0);
+      }
+    }
+    else
+    {
+      // Neither a string, nor a list of strings. Bad request.
+      return;
+    }
+
     DicomUserConnection connection;
     ConnectToModality(connection, remote);
 
-    const std::string& resourceId = call.GetPostBody();
-
-    Json::Value found;
-    if (context.GetIndex().LookupResource(found, resourceId, ResourceType_Series))
+    for (std::list<std::string>::const_iterator 
+           it = instances.begin(); it != instances.end(); it++)
     {
-      // The UUID corresponds to a series
-      context.GetIndex().LogExportedResource(resourceId, remote);
-
-      for (Json::Value::ArrayIndex i = 0; i < found["Instances"].size(); i++)
-      {
-        std::string instanceId = found["Instances"][i].asString();
-        std::string dicom;
-        context.ReadFile(dicom, instanceId, FileContentType_Dicom);
-        connection.Store(dicom);
-      }
-
-      call.GetOutput().AnswerBuffer("{}", "application/json");
+      std::string dicom;
+      context.ReadFile(dicom, *it, FileContentType_Dicom);
+      connection.Store(dicom);
     }
-    else if (context.GetIndex().LookupResource(found, resourceId, ResourceType_Instance))
-    {
-      // The UUID corresponds to an instance
-      context.GetIndex().LogExportedResource(resourceId, remote);
 
-      std::string dicom;
-      context.ReadFile(dicom, resourceId, FileContentType_Dicom);
-      connection.Store(dicom);
-
-      call.GetOutput().AnswerBuffer("{}", "application/json");
-    }
-    else
-    {
-      // The POST body is not a known resource, assume that it
-      // contains a raw DICOM instance
-      connection.Store(resourceId);
-      call.GetOutput().AnswerBuffer("{}", "application/json");
-    }
+    call.GetOutput().AnswerBuffer("{}", "application/json");
   }
 
 
--- a/OrthancServer/OrthancRestApi.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/OrthancRestApi.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerContext.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerContext.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerContext.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerContext.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerEnumerations.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerEnumerations.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerEnumerations.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerEnumerations.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerIndex.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerIndex.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerIndex.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerIndex.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerToolbox.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerToolbox.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ServerToolbox.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ServerToolbox.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ToDcmtkBridge.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ToDcmtkBridge.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/ToDcmtkBridge.h	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/ToDcmtkBridge.h	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/OrthancServer/main.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/OrthancServer/main.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
@@ -39,6 +39,7 @@
 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h"
 #include "../Core/HttpServer/FilesystemHttpHandler.h"
 #include "../Core/Lua/LuaFunctionCall.h"
+#include "../Core/DicomFormat/DicomArray.h"
 #include "DicomProtocol/DicomServer.h"
 #include "OrthancInitialization.h"
 #include "ServerContext.h"
@@ -47,13 +48,13 @@
 
 
 
-class MyDicomStore : public IStoreRequestHandler
+class MyStoreRequestHandler : public IStoreRequestHandler
 {
 private:
   ServerContext& server_;
 
 public:
-  MyDicomStore(ServerContext& context) :
+  MyStoreRequestHandler(ServerContext& context) :
     server_(context)
   {
   }
@@ -71,24 +72,78 @@
 };
 
 
-class MyDicomStoreFactory : public IStoreRequestHandlerFactory
+class MyFindRequestHandler : public IFindRequestHandler
+{
+private:
+  ServerContext& context_;
+
+public:
+  MyFindRequestHandler(ServerContext& context) :
+    context_(context)
+  {
+  }
+
+  virtual void Handle(const DicomMap& input,
+                      DicomFindAnswers& answers)
+  {
+    LOG(WARNING) << "Find-SCU request received";
+    DicomArray a(input);
+    a.Print(stdout);
+  }
+};
+
+
+class MyMoveRequestHandler : public IMoveRequestHandler
 {
 private:
-  ServerContext& server_;
+  ServerContext& context_;
+
+public:
+  MyMoveRequestHandler(ServerContext& context) :
+    context_(context)
+  {
+  }
 
 public:
-  MyDicomStoreFactory(ServerContext& context) : server_(context)
+  virtual IMoveRequestIterator* Handle(const std::string& target,
+                                       const DicomMap& input)
+  {
+    LOG(WARNING) << "Move-SCU request received";
+    return NULL;
+  }
+};
+
+
+class MyDicomServerFactory : 
+  public IStoreRequestHandlerFactory,
+  public IFindRequestHandlerFactory, 
+  public IMoveRequestHandlerFactory
+{
+private:
+  ServerContext& context_;
+
+public:
+  MyDicomServerFactory(ServerContext& context) : context_(context)
   {
   }
 
   virtual IStoreRequestHandler* ConstructStoreRequestHandler()
   {
-    return new MyDicomStore(server_);
+    return new MyStoreRequestHandler(context_);
+  }
+
+  virtual IFindRequestHandler* ConstructFindRequestHandler()
+  {
+    return new MyFindRequestHandler(context_);
+  }
+
+  virtual IMoveRequestHandler* ConstructMoveRequestHandler()
+  {
+    return new MyMoveRequestHandler(context_);
   }
 
   void Done()
   {
-    //index_.db().Execute("DELETE FROM Studies");
   }
 };
 
@@ -252,13 +307,16 @@
       context.GetIndex().SetMaximumStorageSize(0);
     }
 
-    MyDicomStoreFactory storeScp(context);
+    MyDicomServerFactory serverFactory(context);
+    
 
     {
       // DICOM server
       DicomServer dicomServer;
       dicomServer.SetCalledApplicationEntityTitleCheck(GetGlobalBoolParameter("DicomCheckCalledAet", false));
-      dicomServer.SetStoreRequestHandlerFactory(storeScp);
+      dicomServer.SetStoreRequestHandlerFactory(serverFactory);
+      //dicomServer.SetMoveRequestHandlerFactory(serverFactory);
+      //dicomServer.SetFindRequestHandlerFactory(serverFactory);
       dicomServer.SetPortNumber(GetGlobalIntegerParameter("DicomPort", 4242));
       dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC"));
 
@@ -304,7 +362,7 @@
       LOG(WARNING) << "Orthanc is stopping";
     }
 
-    storeScp.Done();
+    serverFactory.Done();
   }
   catch (OrthancException& e)
   {
--- a/Resources/CMake/MongooseConfiguration.cmake	Thu May 02 16:34:00 2013 +0200
+++ b/Resources/CMake/MongooseConfiguration.cmake	Thu May 02 16:51:40 2013 +0200
@@ -1,33 +1,48 @@
-SET(MONGOOSE_SOURCES_DIR ${CMAKE_BINARY_DIR}/mongoose)
-DownloadPackage("http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/mongoose-3.1.tgz" "${MONGOOSE_SOURCES_DIR}" "" "")
+if (STATIC_BUILD OR NOT USE_DYNAMIC_MONGOOSE)
+  SET(MONGOOSE_SOURCES_DIR ${CMAKE_BINARY_DIR}/mongoose)
+  DownloadPackage("http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/mongoose-3.1.tgz" "${MONGOOSE_SOURCES_DIR}" "" "")
 
-# Patch mongoose
-execute_process(
-  COMMAND patch mongoose.c ${CMAKE_SOURCE_DIR}/Resources/Patches/mongoose-patch.diff
-  WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR}
-  )
+  # Patch mongoose
+  execute_process(
+    COMMAND patch mongoose.c ${CMAKE_SOURCE_DIR}/Resources/Patches/mongoose-patch.diff
+    WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR}
+    )
 
-include_directories(
-  ${MONGOOSE_SOURCES_DIR}
-  )
+  include_directories(
+    ${MONGOOSE_SOURCES_DIR}
+    )
 
-list(APPEND THIRD_PARTY_SOURCES
-  ${MONGOOSE_SOURCES_DIR}/mongoose.c
-  )
+  list(APPEND THIRD_PARTY_SOURCES
+    ${MONGOOSE_SOURCES_DIR}/mongoose.c
+    )
 
 
-if (${ENABLE_SSL})
-  add_definitions(
-    -DNO_SSL_DL=1
-    )
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-    link_libraries(dl)
+  if (${ENABLE_SSL})
+    add_definitions(
+      -DNO_SSL_DL=1
+      )
+    if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+      link_libraries(dl)
+    endif()
+
+  else()
+    add_definitions(
+      -DNO_SSL=1   # Remove SSL support from mongoose
+      )
   endif()
 
+  source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)
+
 else()
-  add_definitions(
-    -DNO_SSL=1   # Remove SSL support from mongoose
-    )
+  CHECK_INCLUDE_FILE_CXX(mongoose.h HAVE_MONGOOSE_H)
+  if (NOT HAVE_MONGOOSE_H)
+    message(FATAL_ERROR "Please install the mongoose-devel package")
+  endif()
+
+  CHECK_LIBRARY_EXISTS(mongoose mg_start "" HAVE_MONGOOSE_LIB)
+  if (NOT HAVE_MONGOOSE_LIB)
+    message(FATAL_ERROR "Please install the mongoose-devel package")
+  endif()
+
+  link_libraries(mongoose)
 endif()
-
-source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)
--- a/Resources/CMake/OpenSslConfiguration.cmake	Thu May 02 16:34:00 2013 +0200
+++ b/Resources/CMake/OpenSslConfiguration.cmake	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 if (${STATIC_BUILD})
   SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.0.1c)
-  DownloadPackage("http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/openssl-1.0.1c.tar.gz" "${OPENSSL_SOURCES_DIR}" "" "")
+  DownloadPackage("www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/openssl-1.0.1c.tar.gz" "${OPENSSL_SOURCES_DIR}" "" "")
 
   if (NOT EXISTS "${OPENSSL_SOURCES_DIR}/include/PATCHED")
     if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
--- a/Resources/Configuration.json	Thu May 02 16:34:00 2013 +0200
+++ b/Resources/Configuration.json	Thu May 02 16:51:40 2013 +0200
@@ -60,7 +60,7 @@
 
 
     /**
-     * Security-related options
+     * Security-related options for the HTTP server
      **/
 
     // Whether remote hosts can connect to the HTTP server
@@ -69,7 +69,7 @@
     // Whether or not SSL is enabled
     "SslEnabled" : false,
 
-    // Path to the SSL certificate
+    // Path to the SSL certificate (meaningful only if SSL is enabled)
     "SslCertificate" : "certificate.pem",
 
     // Whether or not the password protection is enabled
--- a/Resources/EmbedResources.py	Thu May 02 16:34:00 2013 +0200
+++ b/Resources/EmbedResources.py	Thu May 02 16:51:40 2013 +0200
@@ -1,5 +1,5 @@
 # Orthanc - A Lightweight, RESTful DICOM Store
-# Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+# Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
 # Belgium
 #
 # This program is free software: you can redistribute it and/or
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Samples/Python/HighPerformanceAutoRouting.py	Thu May 02 16:51:40 2013 +0200
@@ -0,0 +1,138 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+
+URL = 'http://localhost:8042'
+TARGET = 'sample'
+
+
+#
+# This sample code shows how to setup a simple, high-performance DICOM
+# auto-routing. All the DICOM instances that arrive inside Orthanc
+# will be sent to a remote modality. A producer-consumer pattern is
+# used. The target modality is specified by the TARGET variable above:
+# It must match an entry in the Orthanc configuration file inside the
+# "DicomModalities" section.
+#
+# NOTE: This sample only works with Orthanc >= 0.5.2. Make sure that
+# Orthanc was built with "-DCMAKE_BUILD_TYPE=Release" to get the best
+# performance.
+#
+
+import Queue
+import sys
+import time
+import threading
+
+import RestToolbox
+
+
+#
+# Queue that is shared between the producer and the consumer
+# threads. It holds the instances that are still to be sent.
+#
+
+queue = Queue.Queue()
+
+
+#
+# The producer thread. It monitors the arrival of new instances into
+# Orthanc, and pushes their ID into the shared queue. This code is
+# based upon the "ChangesLoop.py" sample code.
+#
+
+def Producer(queue):
+    current = 0
+
+    while True:
+        r = RestToolbox.DoGet(URL + '/changes', {
+            'since' : current,
+            'limit' : 4   # Retrieve at most 4 changes at once
+            })
+
+        for change in r['Changes']:
+            # We are only interested interested in the arrival of new instances
+            if change['ChangeType'] == 'NewInstance':
+                queue.put(change['ID'])
+
+        current = r['Last']
+
+        if r['Done']:
+            time.sleep(1)
+
+
+#
+# The consumer thread. It continuously reads the instances from the
+# queue, and send them to the remote modality. Each time a packet of
+# instances is sent, a single DICOM connexion is used, hence improving
+# the performance.
+#
+
+def Consumer(queue):
+    TIMEOUT = 0.1
+    
+    while True:
+        instances = []
+
+        while True:
+            try:
+                # Block for a while, waiting for the arrival of a new
+                # instance
+                instance = queue.get(True, TIMEOUT)
+
+                # A new instance has arrived: Record its ID
+                instances.append(instance)
+                queue.task_done()
+
+            except Queue.Empty:
+                # Timeout: No more data was received
+                break
+
+        if len(instances) > 0:
+            print 'Sending a packet of %d instances' % len(instances)
+            start = time.time()
+
+            # Send all the instances with a single DICOM connexion
+            RestToolbox.DoPost('%s/modalities/sample/store' % URL, instances)
+
+            # Remove all the instances from Orthanc
+            for instance in instances:
+                RestToolbox.DoDelete('%s/instances/%s' % (URL, instance))
+
+            end = time.time()
+            print 'The packet of %d instances has been sent in %d seconds' % (len(instances), end - start)
+
+
+#
+# Thread to display the progress
+#
+
+def PrintProgress(queue):
+    while True:
+        print 'Current queue size: %d' % (queue.qsize())
+        time.sleep(1)
+
+
+#
+# Start the various threads
+#
+
+progress = threading.Thread(None, PrintProgress, None, (queue, ))
+progress.daemon = True
+progress.start()
+
+producer = threading.Thread(None, Producer, None, (queue, ))
+producer.daemon = True
+producer.start()
+
+consumer = threading.Thread(None, Consumer, None, (queue, ))
+consumer.daemon = True
+consumer.start()
+
+
+#
+# Active waiting for Ctrl-C
+#
+
+while True:
+    time.sleep(0.1)
--- a/Resources/Samples/RestApi/Sample.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Resources/Samples/RestApi/Sample.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/Resources/Samples/RestApiLinuxDynamic/Sample.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/Resources/Samples/RestApiLinuxDynamic/Sample.cpp	Thu May 02 16:51:40 2013 +0200
@@ -1,6 +1,6 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
+ * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
  * Belgium
  *
  * This program is free software: you can redistribute it and/or
--- a/UnitTests/main.cpp	Thu May 02 16:34:00 2013 +0200
+++ b/UnitTests/main.cpp	Thu May 02 16:51:40 2013 +0200
@@ -29,6 +29,23 @@
   ASSERT_FALSE(Toolbox::IsUuid(""));
   ASSERT_FALSE(Toolbox::IsUuid("012345678901234567890123456789012345"));
   ASSERT_TRUE(Toolbox::IsUuid("550e8400-e29b-41d4-a716-446655440000"));
+  ASSERT_FALSE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-44665544000"));
+  ASSERT_TRUE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-446655440000"));
+  ASSERT_TRUE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-446655440000 ok"));
+  ASSERT_FALSE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-446655440000ok"));
+}
+
+TEST(Toolbox, IsSHA1)
+{
+  ASSERT_FALSE(Toolbox::IsSHA1(""));
+  ASSERT_FALSE(Toolbox::IsSHA1("01234567890123456789012345678901234567890123"));
+  ASSERT_FALSE(Toolbox::IsSHA1("012345678901234567890123456789012345678901234"));
+  ASSERT_TRUE(Toolbox::IsSHA1("b5ed549f-956400ce-69a8c063-bf5b78be-2732a4b9"));
+
+  std::string s;
+  Toolbox::ComputeSHA1(s, "The quick brown fox jumps over the lazy dog");
+  ASSERT_TRUE(Toolbox::IsSHA1(s));
+  ASSERT_EQ("2fd4e1c6-7a2d28fc-ed849ee1-bb76e739-1b93eb12", s);
 }
 
 TEST(Zlib, Basic)