diff Core/HttpServer/IHttpHandler.h @ 3395:0ce9b4f5fdf5

new abstraction: IHttpHandler::CreateStreamHandler()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Jun 2019 18:54:27 +0200
parents 4e43e67f8ecf
children 962e5f00744b
line wrap: on
line diff
--- a/Core/HttpServer/IHttpHandler.h	Thu Jun 06 16:42:41 2019 +0200
+++ b/Core/HttpServer/IHttpHandler.h	Thu Jun 06 18:54:27 2019 +0200
@@ -49,10 +49,34 @@
     typedef std::map<std::string, std::string>                  Arguments;
     typedef std::vector< std::pair<std::string, std::string> >  GetArguments;
 
+
+    class IStream : public boost::noncopyable
+    {
+    public:
+      virtual ~IStream()
+      {
+      }
+
+      virtual void AddBodyChunk(const void* data,
+                                size_t size) = 0;
+
+      virtual void Execute(HttpOutput& output) = 0;
+    };
+
+
     virtual ~IHttpHandler()
     {
     }
 
+    // This function is called for each incomding POST/PUT request
+    // (new in Orthanc 1.5.7). It allows to deal with chunked transfers.
+    virtual IStream* CreateStreamHandler(RequestOrigin origin,
+                                         const char* remoteIp,
+                                         const char* username,
+                                         HttpMethod method,
+                                         const UriComponents& uri,
+                                         const Arguments& headers) = 0;
+
     virtual bool Handle(HttpOutput& output,
                         RequestOrigin origin,
                         const char* remoteIp,