changeset 1868:87de32ac3ea7

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Jan 2022 10:45:58 +0100
parents 4fa025398a38
children da224ae2a994
files Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Applications/Resources/Orthanc/Plugins/OrthancPluginException.h Applications/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake
diffstat 4 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Thu Dec 23 16:06:37 2021 +0100
+++ b/Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Tue Jan 11 10:45:58 2022 +0100
@@ -3,6 +3,7 @@
  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  * Copyright (C) 2017-2021 Osimis S.A., Belgium
+ * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -539,6 +540,13 @@
                               const std::string& password)
   {
     Clear();
+
+    if (body.size() > 0xffffffffu)
+    {
+      LogError("Cannot handle body size > 4GB");
+      ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
+    }
+
     return CheckHttp(OrthancPluginHttpPost(GetGlobalContext(), &buffer_, url.c_str(),
                                            body.c_str(), body.size(),
                                            username.empty() ? NULL : username.c_str(),
@@ -552,6 +560,13 @@
                              const std::string& password)
   {
     Clear();
+
+    if (body.size() > 0xffffffffu)
+    {
+      LogError("Cannot handle body size > 4GB");
+      ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
+    }
+
     return CheckHttp(OrthancPluginHttpPut(GetGlobalContext(), &buffer_, url.c_str(),
                                           body.empty() ? NULL : body.c_str(),
                                           body.size(),
@@ -1892,6 +1907,12 @@
       ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange);
     }
 
+    if (body.size() > 0xffffffffu)
+    {
+      LogError("Cannot handle body size > 4GB");
+      ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
+    }
+
     OrthancPlugins::MemoryBuffer answer;
     uint16_t status;
     OrthancPluginErrorCode code = OrthancPluginCallPeerApi
@@ -1920,6 +1941,12 @@
       ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange);
     }
 
+    if (body.size() > 0xffffffffu)
+    {
+      LogError("Cannot handle body size > 4GB");
+      ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
+    }
+
     OrthancPlugins::MemoryBuffer answer;
     uint16_t status;
     OrthancPluginErrorCode code = OrthancPluginCallPeerApi
@@ -2569,8 +2596,8 @@
   
   void HttpClient::ClearCredentials()
   {
-    username_.empty();
-    password_.empty();
+    username_.clear();
+    password_.clear();
   }
 
 
@@ -2883,6 +2910,12 @@
 
     MemoryBuffer answerBodyBuffer, answerHeadersBuffer;
 
+    if (body.size() > 0xffffffffu)
+    {
+      LogError("Cannot handle body size > 4GB");
+      ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
+    }
+
     OrthancPluginErrorCode error = OrthancPluginHttpClient(
       GetGlobalContext(),
       *answerBodyBuffer,
--- a/Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Thu Dec 23 16:06:37 2021 +0100
+++ b/Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Tue Jan 11 10:45:58 2022 +0100
@@ -3,6 +3,7 @@
  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  * Copyright (C) 2017-2021 Osimis S.A., Belgium
+ * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
--- a/Applications/Resources/Orthanc/Plugins/OrthancPluginException.h	Thu Dec 23 16:06:37 2021 +0100
+++ b/Applications/Resources/Orthanc/Plugins/OrthancPluginException.h	Tue Jan 11 10:45:58 2022 +0100
@@ -3,6 +3,7 @@
  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  * Copyright (C) 2017-2021 Osimis S.A., Belgium
+ * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
--- a/Applications/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake	Thu Dec 23 16:06:37 2021 +0100
+++ b/Applications/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake	Tue Jan 11 10:45:58 2022 +0100
@@ -2,6 +2,7 @@
 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 # Department, University Hospital of Liege, Belgium
 # Copyright (C) 2017-2021 Osimis S.A., Belgium
+# Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
 #
 # This program is free software: you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as