diff OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4650:9804d6490872

Reduced memory consumption of HTTP/REST plugins calls on POST/PUT if chunked transfer is disabled
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 May 2021 10:57:42 +0200
parents 5fabef29c4ff
children f0038043fb97 94616af363ec
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Fri Apr 30 10:09:50 2021 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue May 04 10:57:42 2021 +0200
@@ -3332,12 +3332,12 @@
 
       case OrthancPluginHttpMethod_Post:
         client.SetMethod(HttpMethod_Post);
-        client.GetBody().assign(reinterpret_cast<const char*>(parameters.body), parameters.bodySize);
+        client.SetExternalBody(parameters.body, parameters.bodySize);
         break;
 
       case OrthancPluginHttpMethod_Put:
         client.SetMethod(HttpMethod_Put);
-        client.GetBody().assign(reinterpret_cast<const char*>(parameters.body), parameters.bodySize);
+        client.SetExternalBody(parameters.body, parameters.bodySize);
         break;
 
       case OrthancPluginHttpMethod_Delete:
@@ -3446,7 +3446,7 @@
     if (p.method == OrthancPluginHttpMethod_Post ||
         p.method == OrthancPluginHttpMethod_Put)
     {
-      client.GetBody().assign(reinterpret_cast<const char*>(p.body), p.bodySize);
+      client.SetExternalBody(p.body, p.bodySize);
     }
     
     SetupHttpClient(client, p);
@@ -3645,12 +3645,12 @@
 
       case OrthancPluginHttpMethod_Post:
         client.SetMethod(HttpMethod_Post);
-        client.GetBody().assign(reinterpret_cast<const char*>(p.body), p.bodySize);
+        client.SetExternalBody(p.body, p.bodySize);
         break;
 
       case OrthancPluginHttpMethod_Put:
         client.SetMethod(HttpMethod_Put);
-        client.GetBody().assign(reinterpret_cast<const char*>(p.body), p.bodySize);
+        client.SetExternalBody(p.body, p.bodySize);
         break;
 
       case OrthancPluginHttpMethod_Delete: