# HG changeset patch # User Sebastien Jodogne # Date 1641894358 -3600 # Node ID 87de32ac3ea77ea4b5334c2d681d2c274707fc2f # Parent 4fa025398a38bd37b9ce3c28f836453e05920cb1 sync diff -r 4fa025398a38 -r 87de32ac3ea7 Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- 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, diff -r 4fa025398a38 -r 87de32ac3ea7 Applications/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h --- 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 diff -r 4fa025398a38 -r 87de32ac3ea7 Applications/Resources/Orthanc/Plugins/OrthancPluginException.h --- 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 diff -r 4fa025398a38 -r 87de32ac3ea7 Applications/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake --- 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