diff Core/HttpClient.h @ 3386:af9432e46c07

HttpClient::IBodyStream
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Jun 2019 14:40:14 +0200
parents 4e43e67f8ecf
children a48d652f1500
line wrap: on
line diff
--- a/Core/HttpClient.h	Mon Jun 03 10:30:14 2019 +0200
+++ b/Core/HttpClient.h	Wed Jun 05 14:40:14 2019 +0200
@@ -37,6 +37,7 @@
 #include "WebServiceParameters.h"
 
 #include <string>
+#include <boost/noncopyable.hpp>
 #include <boost/shared_ptr.hpp>
 #include <json/json.h>
 
@@ -51,12 +52,24 @@
 
 namespace Orthanc
 {
-  class HttpClient
+  class HttpClient : public boost::noncopyable
   {
   public:
     typedef std::map<std::string, std::string>  HttpHeaders;
 
+    class IBodyStream : public boost::noncopyable
+    {
+    public:
+      virtual ~IBodyStream()
+      {
+      }
+      
+      virtual bool ReadNextChunk(std::string& chunk) = 0;
+    };
+
   private:
+    class CurlHeaders;
+    class CurlBodyStream;
     class GlobalParameters;
 
     struct PImpl;
@@ -133,10 +146,7 @@
       return timeout_;
     }
 
-    void SetBody(const std::string& data)
-    {
-      body_ = data;
-    }
+    void SetBody(const std::string& data);
 
     std::string& GetBody()
     {
@@ -148,6 +158,10 @@
       return body_;
     }
 
+    void SetBodyStream(IBodyStream& stream);
+
+    void ClearBodyStream();
+
     void SetVerbose(bool isVerbose);
 
     bool IsVerbose() const