Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1547:5e65349c896b | 1548:e9325f3ac496 |
---|---|
312 if (!index_.LookupAttachment(attachment, instancePublicId, content)) | 312 if (!index_.LookupAttachment(attachment, instancePublicId, content)) |
313 { | 313 { |
314 throw OrthancException(ErrorCode_InternalError); | 314 throw OrthancException(ErrorCode_InternalError); |
315 } | 315 } |
316 | 316 |
317 #if 1 | 317 IStorageArea& area = accessor_.GetStorageArea(); |
318 accessor_.SetCompressionForNextOperations(attachment.GetCompressionType()); | 318 |
319 | 319 BufferHttpSender sender; |
320 std::auto_ptr<HttpFileSender> sender(accessor_.ConstructHttpFileSender(attachment.GetUuid(), attachment.GetContentType())); | 320 area.Read(sender.GetBuffer(), attachment.GetUuid(), content); |
321 sender->SetContentType(GetMimeType(content)); | |
322 sender->SetContentFilename(attachment.GetUuid() + ".dcm"); // TODO ".dcm" => ToMimeType(content) | |
323 output.AnswerStream(*sender); | |
324 #else | |
325 const FilesystemStorage& a = dynamic_cast<FilesystemStorage&>(accessor_.GetStorageArea()); | |
326 | |
327 FilesystemHttpSender sender(a, attachment.GetUuid()); | |
328 sender.SetContentType(GetMimeType(content)); | 321 sender.SetContentType(GetMimeType(content)); |
329 sender.SetContentFilename(attachment.GetUuid() + ".dcm"); | 322 sender.SetContentFilename(attachment.GetUuid() + std::string(GetFileExtension(content))); |
330 | 323 |
331 HttpStreamTranscoder transcoder(sender, attachment.GetCompressionType()); | 324 HttpStreamTranscoder transcoder(sender, attachment.GetCompressionType()); |
332 output.AnswerStream(transcoder); | 325 output.AnswerStream(transcoder); |
333 #endif | |
334 } | 326 } |
335 | 327 |
336 | 328 |
337 void ServerContext::ReadJson(Json::Value& result, | 329 void ServerContext::ReadJson(Json::Value& result, |
338 const std::string& instancePublicId) | 330 const std::string& instancePublicId) |