Mercurial > hg > orthanc
diff OrthancServer/ServerContext.cpp @ 1548:e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 Aug 2015 11:52:03 +0200 |
parents | f9b0169eb6bb |
children | e5e975e9b738 |
line wrap: on
line diff
--- 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<HttpFileSender> 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<FilesystemStorage&>(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 }