Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestApi.cpp @ 3695:898903022836 storage-commitment
integration mainline->storage-commitment
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 26 Feb 2020 10:39:55 +0100 |
parents | e85bfba2d307 |
children | 2a170a8f1faf |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Thu Feb 20 20:36:47 2020 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Wed Feb 26 10:39:55 2020 +0100 @@ -34,11 +34,14 @@ #include "../PrecompiledHeadersServer.h" #include "OrthancRestApi.h" +#include "../../Core/Compression/GzipCompressor.h" #include "../../Core/Logging.h" #include "../../Core/MetricsRegistry.h" #include "../../Core/SerializationToolbox.h" #include "../ServerContext.h" +#include <boost/algorithm/string/predicate.hpp> + namespace Orthanc { static void SetupResourceAnswer(Json::Value& result, @@ -118,13 +121,22 @@ "Received an empty DICOM file"); } - // TODO Remove unneccessary memcpy - std::string postData; - call.BodyToString(postData); + std::string dicom; + + if (boost::iequals(call.GetHttpHeader("content-encoding", ""), "gzip")) + { + GzipCompressor compressor; + compressor.Uncompress(dicom, call.GetBodyData(), call.GetBodySize()); + } + else + { + // TODO Remove unneccessary memcpy + call.BodyToString(dicom); + } DicomInstanceToStore toStore; toStore.SetOrigin(DicomInstanceOrigin::FromRest(call)); - toStore.SetBuffer(postData); + toStore.SetBuffer(dicom); std::string publicId; StoreStatus status = context.Store(publicId, toStore);