Mercurial > hg > orthanc
comparison Core/HttpServer/BufferHttpSender.h @ 1525:f9b0169eb6bb
testing
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Aug 2015 17:50:38 +0200 |
parents | c388502a066d |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1524:4a0c2eedceb6 | 1525:f9b0169eb6bb |
---|---|
36 namespace Orthanc | 36 namespace Orthanc |
37 { | 37 { |
38 class BufferHttpSender : public HttpFileSender | 38 class BufferHttpSender : public HttpFileSender |
39 { | 39 { |
40 private: | 40 private: |
41 std::string buffer_; | 41 std::string buffer_; |
42 bool done_; | 42 size_t position_; |
43 size_t chunkSize_; | |
44 size_t currentChunkSize_; | |
43 | 45 |
44 public: | 46 public: |
45 BufferHttpSender() : done_(false) | 47 BufferHttpSender(); |
46 { | |
47 } | |
48 | 48 |
49 std::string& GetBuffer() | 49 std::string& GetBuffer() |
50 { | 50 { |
51 return buffer_; | 51 return buffer_; |
52 } | 52 } |
54 const std::string& GetBuffer() const | 54 const std::string& GetBuffer() const |
55 { | 55 { |
56 return buffer_; | 56 return buffer_; |
57 } | 57 } |
58 | 58 |
59 // This is for test purpose. If "chunkSize" is set to "0" (the | |
60 // default), the entire buffer is consumed at once. | |
61 void SetChunkSize(size_t chunkSize) | |
62 { | |
63 chunkSize_ = chunkSize; | |
64 } | |
65 | |
59 | 66 |
60 /** | 67 /** |
61 * Implementation of the IHttpStreamAnswer interface. | 68 * Implementation of the IHttpStreamAnswer interface. |
62 **/ | 69 **/ |
63 | |
64 virtual HttpCompression SetupHttpCompression(bool /*gzipAllowed*/, | |
65 bool /*deflateAllowed*/) | |
66 { | |
67 // No compression is supported | |
68 return HttpCompression_None; | |
69 } | |
70 | 70 |
71 virtual uint64_t GetContentLength() | 71 virtual uint64_t GetContentLength() |
72 { | 72 { |
73 return buffer_.size(); | 73 return buffer_.size(); |
74 } | 74 } |