comparison OrthancFramework/Sources/HttpServer/HttpFileSender.cpp @ 5406:aaf7c49a9ddc am-http-compression

tentative to implement smart HTTP compression with detection of transfer syntax
author Alain Mazy <am@osimis.io>
date Sat, 04 Nov 2023 13:42:30 +0100
parents 0ea402b4d901
children
comparison
equal deleted inserted replaced
5405:62bb63346185 5406:aaf7c49a9ddc
30 30
31 #include <boost/lexical_cast.hpp> 31 #include <boost/lexical_cast.hpp>
32 32
33 namespace Orthanc 33 namespace Orthanc
34 { 34 {
35 void HttpFileSender::SetContentCompression(ContentCompression contentCompression)
36 {
37 contentCompression_ = contentCompression;
38 }
39
35 void HttpFileSender::SetContentType(MimeType contentType) 40 void HttpFileSender::SetContentType(MimeType contentType)
36 { 41 {
37 contentType_ = EnumerationToString(contentType); 42 contentType_ = EnumerationToString(contentType);
38 } 43 }
39 44
45 const std::string &HttpFileSender::GetContentType() const 50 const std::string &HttpFileSender::GetContentType() const
46 { 51 {
47 return contentType_; 52 return contentType_;
48 } 53 }
49 54
55 ContentCompression HttpFileSender::GuessContentCompression() const
56 {
57 return contentCompression_;
58 }
59
50 void HttpFileSender::SetContentFilename(const std::string& filename) 60 void HttpFileSender::SetContentFilename(const std::string& filename)
51 { 61 {
52 filename_ = filename; 62 filename_ = filename;
53 63
54 if (contentType_.empty()) 64 if (contentType_.empty())
55 { 65 {
56 contentType_ = SystemToolbox::AutodetectMimeType(filename); 66 MimeType mimeType = SystemToolbox::AutodetectMimeType(filename);
67 contentType_ = EnumerationToString(mimeType);
68 contentCompression_ = SystemToolbox::GuessContentCompression(mimeType);
57 } 69 }
58 } 70 }
59 71
60 const std::string &HttpFileSender::GetContentFilename() const 72 const std::string &HttpFileSender::GetContentFilename() const
61 { 73 {