diff OrthancFramework/Sources/HttpServer/HttpOutput.h @ 4672:d9942d48fea7

ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Jun 2021 17:35:39 +0200
parents d9473bd5ed43
children 7053502fbf97
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/HttpOutput.h	Fri May 28 18:44:00 2021 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpOutput.h	Wed Jun 02 17:35:39 2021 +0200
@@ -47,7 +47,8 @@
         State_WritingHeader,      
         State_WritingBody,
         State_WritingMultipart,
-        State_Done
+        State_Done,
+        State_WritingStream
       };
 
     private:
@@ -64,6 +65,8 @@
       std::string multipartBoundary_;
       std::string multipartContentType_;
 
+      void StartStreamInternal(const std::string& contentType);
+
     public:
       StateMachine(IHttpOutputStream& stream,
                    bool isKeepAlive);
@@ -105,6 +108,13 @@
       }
 
       void CheckHeadersCompatibilityWithMultipart() const;
+
+      void StartStream(const std::string& contentType);
+
+      void SendStreamItem(const void* data,
+                          size_t size);
+
+      void CloseStream();
     };
 
     StateMachine stateMachine_;
@@ -185,5 +195,12 @@
       const std::vector<const void*>& parts,
       const std::vector<size_t>& sizes,
       const std::vector<const std::map<std::string, std::string>*>& headers);
+
+    /**
+     * Contrarily to "Answer()", this method doesn't bufferizes the
+     * stream before sending it, which reduces memory but cannot be
+     * used to handle compression using "Content-Encoding".
+     **/
+    void AnswerWithoutBuffering(IHttpStreamAnswer& stream);
   };
 }