# HG changeset patch # User Sebastien Jodogne # Date 1439545923 -7200 # Node ID e9325f3ac496cf65e935436f60e99efaf55ff296 # Parent 5e65349c896b9da4f225952fdc38825cfa800fbe Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate diff -r 5e65349c896b -r e9325f3ac496 Core/Enumerations.cpp --- a/Core/Enumerations.cpp Fri Aug 14 11:26:44 2015 +0200 +++ b/Core/Enumerations.cpp Fri Aug 14 11:52:03 2015 +0200 @@ -674,4 +674,21 @@ 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 ""; + } + } } diff -r 5e65349c896b -r e9325f3ac496 Core/Enumerations.h --- a/Core/Enumerations.h Fri Aug 14 11:26:44 2015 +0200 +++ b/Core/Enumerations.h Fri Aug 14 11:52:03 2015 +0200 @@ -378,4 +378,6 @@ const char* specificCharacterSet); const char* GetMimeType(FileContentType type); + + const char* GetFileExtension(FileContentType type); } diff -r 5e65349c896b -r e9325f3ac496 Core/HttpServer/HttpStreamTranscoder.cpp --- a/Core/HttpServer/HttpStreamTranscoder.cpp Fri Aug 14 11:26:44 2015 +0200 +++ b/Core/HttpServer/HttpStreamTranscoder.cpp Fri Aug 14 11:52:03 2015 +0200 @@ -39,6 +39,8 @@ #include // For memcpy() #include +#include + namespace Orthanc { void HttpStreamTranscoder::ReadSource(std::string& buffer) diff -r 5e65349c896b -r e9325f3ac496 NEWS --- a/NEWS Fri Aug 14 11:26:44 2015 +0200 +++ b/NEWS Fri Aug 14 11:52:03 2015 +0200 @@ -8,9 +8,10 @@ Maintenance ----------- +* Many code refactorings * Upgrade to curl 7.44.0 for static and Windows builds * Upgrade to libcurl 1.0.2d for static and Windows builds -* Many code refactorings +* Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate Version 0.9.3 (2015/08/07) diff -r 5e65349c896b -r e9325f3ac496 OrthancServer/ServerContext.cpp --- a/OrthancServer/ServerContext.cpp Fri Aug 14 11:26:44 2015 +0200 +++ b/OrthancServer/ServerContext.cpp Fri Aug 14 11:52:03 2015 +0200 @@ -314,23 +314,15 @@ throw OrthancException(ErrorCode_InternalError); } -#if 1 - accessor_.SetCompressionForNextOperations(attachment.GetCompressionType()); + IStorageArea& area = accessor_.GetStorageArea(); - std::auto_ptr sender(accessor_.ConstructHttpFileSender(attachment.GetUuid(), attachment.GetContentType())); - sender->SetContentType(GetMimeType(content)); - sender->SetContentFilename(attachment.GetUuid() + ".dcm"); // TODO ".dcm" => ToMimeType(content) - output.AnswerStream(*sender); -#else - const FilesystemStorage& a = dynamic_cast(accessor_.GetStorageArea()); - - FilesystemHttpSender sender(a, attachment.GetUuid()); + BufferHttpSender sender; + area.Read(sender.GetBuffer(), attachment.GetUuid(), content); sender.SetContentType(GetMimeType(content)); - sender.SetContentFilename(attachment.GetUuid() + ".dcm"); - + sender.SetContentFilename(attachment.GetUuid() + std::string(GetFileExtension(content))); + HttpStreamTranscoder transcoder(sender, attachment.GetCompressionType()); output.AnswerStream(transcoder); -#endif }