Mercurial > hg > orthanc
diff Core/HttpServer/FilesystemHttpSender.h @ 1522:f938f7779bcb
fixes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Aug 2015 15:37:42 +0200 |
parents | 8bd0d897763f |
children | c388502a066d |
line wrap: on
line diff
--- a/Core/HttpServer/FilesystemHttpSender.h Tue Aug 11 13:37:24 2015 +0200 +++ b/Core/HttpServer/FilesystemHttpSender.h Tue Aug 11 15:37:42 2015 +0200 @@ -32,6 +32,7 @@ #pragma once #include "HttpFileSender.h" +#include "BufferHttpSender.h" #include "../FileStorage/FilesystemStorage.h" #include <fstream> @@ -41,27 +42,47 @@ class FilesystemHttpSender : public HttpFileSender { private: - boost::filesystem::path path_; - std::ifstream file_; - uint64_t size_; - std::string chunk_; - size_t chunkSize_; + std::ifstream file_; + uint64_t size_; + std::string chunk_; + size_t chunkSize_; + CompressionType sourceCompression_; + HttpCompression targetCompression_; - void Open(); + std::auto_ptr<BufferHttpSender> uncompressed_; + + void Initialize(const boost::filesystem::path& path); public: - FilesystemHttpSender(const char* path); + FilesystemHttpSender(const std::string& path) + { + Initialize(path); + } - FilesystemHttpSender(const boost::filesystem::path& path); + FilesystemHttpSender(const boost::filesystem::path& path) + { + Initialize(path); + } FilesystemHttpSender(const FilesystemStorage& storage, - const std::string& uuid); + const std::string& uuid) + { + Initialize(storage.GetPath(uuid)); + } + + void SetSourceCompression(CompressionType compression) + { + sourceCompression_ = compression; + } /** * Implementation of the IHttpStreamAnswer interface. **/ + virtual HttpCompression GetHttpCompression(bool /*gzipAllowed*/, + bool /*deflateAllowed*/); + virtual uint64_t GetContentLength() { return size_; @@ -69,14 +90,8 @@ virtual bool ReadNextChunk(); - virtual const char* GetChunkContent() - { - return chunk_.c_str(); - } + virtual const char* GetChunkContent(); - virtual size_t GetChunkSize() - { - return chunkSize_; - } + virtual size_t GetChunkSize(); }; }