# HG changeset patch # User Alain Mazy # Date 1760340261 -7200 # Node ID 20bcfe2bad62de6b8687e474581e3f2dd8164bcc # Parent 87063f95da706b6acf51ba6629ac47328d08f876 sync diff -r 87063f95da70 -r 20bcfe2bad62 Resources/Orthanc/CMake/DownloadOrthancFramework.cmake --- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Fri Sep 05 10:30:04 2025 +0200 +++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Mon Oct 13 09:24:21 2025 +0200 @@ -207,6 +207,14 @@ # DICOMweb 1.15 (framework pre-1.12.2) set(ORTHANC_FRAMEWORK_PRE_RELEASE ON) set(ORTHANC_FRAMEWORK_MD5 "ebe8bdf388319f1c9536b2b680451848") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "36cd91a53403") + # Advanced storage 0.2.0 (framework pre-1.12.10) + set(ORTHANC_FRAMEWORK_PRE_RELEASE ON) + set(ORTHANC_FRAMEWORK_MD5 "911105f18a154b5e106985d8fcfcb620") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "9eb77f159b9d") + # Advanced storage 0.2.2 (framework pre-1.12.10) + set(ORTHANC_FRAMEWORK_PRE_RELEASE ON) + set(ORTHANC_FRAMEWORK_MD5 "bd5ba2cec329010b912209345acbdeaf") endif() endif() endif() diff -r 87063f95da70 -r 20bcfe2bad62 Resources/Orthanc/OrthancPluginCodeModel.json --- a/Resources/Orthanc/OrthancPluginCodeModel.json Fri Sep 05 10:30:04 2025 +0200 +++ b/Resources/Orthanc/OrthancPluginCodeModel.json Mon Oct 13 09:24:21 2025 +0200 @@ -2234,7 +2234,7 @@ "value": 2002 }, { - "documentation": "The TCP port of the HTTP server is privileged or already in use", + "documentation": "The TCP port of the HTTP server is privileged or already in use or one of the HTTP bind addresses does not exist", "key": "HttpPortInUse", "value": 2003 }, @@ -5486,6 +5486,37 @@ 12, 9 ] + }, + { + "args": [ + { + "name": "arg0", + "sdk_name": "queueId", + "sdk_type": "const char *" + }, + { + "name": "arg1", + "sdk_name": "valueId", + "sdk_type": "uint64_t" + } + ], + "c_function": "OrthancPluginAcknowledgeQueueValue", + "documentation": { + "args": { + "queueId": "A unique identifier identifying both the plugin and the queue.", + "valueId": "An opaque id obtained from OrthancPluginReserveQueueValue" + }, + "description": [], + "return": "0 if success, other value if error.", + "summary": "Acknowledge that a queue value has been consumed and definitely removes it from the queue." + }, + "return_sdk_enumeration": "OrthancPluginErrorCode", + "return_sdk_type": "enumeration", + "since_sdk": [ + 1, + 12, + 10 + ] } ], "unwrapped_functions": [ @@ -5538,6 +5569,7 @@ "OrthancPluginGetQueueSize", "OrthancPluginSetStableStatus", "OrthancPluginRegisterHttpAuthentication", - "OrthancPluginRegisterAuditLogHandler" + "OrthancPluginRegisterAuditLogHandler", + "OrthancPluginReserveQueueValue" ] } \ No newline at end of file diff -r 87063f95da70 -r 20bcfe2bad62 Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Fri Sep 05 10:30:04 2025 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon Oct 13 09:24:21 2025 +0200 @@ -351,6 +351,34 @@ } } + static void DecodeHttpHeaders(HttpHeaders& target, + const MemoryBuffer& source) + { + Json::Value v; + source.ToJson(v); + + if (v.type() != Json::objectValue) + { + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + + Json::Value::Members members = v.getMemberNames(); + target.clear(); + + for (size_t i = 0; i < members.size(); i++) + { + const Json::Value& h = v[members[i]]; + if (h.type() != Json::stringValue) + { + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + else + { + target[members[i]] = h.asString(); + } + } + } + // helper class to convert std::map of headers to the plugin SDK C structure class PluginHttpHeaders { @@ -2084,8 +2112,30 @@ unsigned int timeout) const { MemoryBuffer buffer; - - if (DoPost(buffer, index, uri, body, headers, timeout)) + HttpHeaders answerHeaders; + + if (DoPost(buffer, answerHeaders, index, uri, body, headers, timeout)) + { + buffer.ToJson(target); + return true; + } + else + { + return false; + } + } + + bool OrthancPeers::DoPost(Json::Value& target, + HttpHeaders& answerHeaders, + size_t index, + const std::string& uri, + const std::string& body, + const HttpHeaders& headers, + unsigned int timeout) const + { + MemoryBuffer buffer; + + if (DoPost(buffer, answerHeaders, index, uri, body, headers, timeout)) { buffer.ToJson(target); return true; @@ -2143,9 +2193,9 @@ const std::string& body, const HttpHeaders& headers) const { - return DoPost(target, index, uri, body, headers, timeout_); - } - + HttpHeaders answerHeaders; + return DoPost(target, answerHeaders, index, uri, body, headers, timeout_); + } bool OrthancPeers::DoPost(MemoryBuffer& target, size_t index, @@ -2154,6 +2204,18 @@ const HttpHeaders& headers, unsigned int timeout) const { + HttpHeaders answerHeaders; + return DoPost(target, answerHeaders, index, uri, body, headers, timeout); + } + + bool OrthancPeers::DoPost(MemoryBuffer& target, + HttpHeaders& answerHeaders, + size_t index, + const std::string& uri, + const std::string& body, + const HttpHeaders& headers, + unsigned int timeout) const + { if (index >= index_.size()) { ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); @@ -2166,17 +2228,20 @@ } OrthancPlugins::MemoryBuffer answer; + OrthancPlugins::MemoryBuffer answerHeadersBuffer; uint16_t status; PluginHttpHeaders pluginHeaders(headers); OrthancPluginErrorCode code = OrthancPluginCallPeerApi - (GetGlobalContext(), *answer, NULL, &status, peers_, + (GetGlobalContext(), *answer, *answerHeadersBuffer, &status, peers_, static_cast(index), OrthancPluginHttpMethod_Post, uri.c_str(), pluginHeaders.GetSize(), pluginHeaders.GetKeys(), pluginHeaders.GetValues(), body.empty() ? NULL : body.c_str(), body.size(), timeout); if (code == OrthancPluginErrorCode_Success) { target.Swap(answer); + DecodeHttpHeaders(answerHeaders, answerHeadersBuffer); + return (status == 200); } else @@ -3223,36 +3288,6 @@ } #endif - - static void DecodeHttpHeaders(HttpHeaders& target, - const MemoryBuffer& source) - { - Json::Value v; - source.ToJson(v); - - if (v.type() != Json::objectValue) - { - ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); - } - - Json::Value::Members members = v.getMemberNames(); - target.clear(); - - for (size_t i = 0; i < members.size(); i++) - { - const Json::Value& h = v[members[i]]; - if (h.type() != Json::stringValue) - { - ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); - } - else - { - target[members[i]] = h.asString(); - } - } - } - - void HttpClient::ExecuteWithoutStream(uint16_t& httpStatus, HttpHeaders& answerHeaders, std::string& answerBody, diff -r 87063f95da70 -r 20bcfe2bad62 Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h --- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Fri Sep 05 10:30:04 2025 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Mon Oct 13 09:24:21 2025 +0200 @@ -879,6 +879,14 @@ unsigned int timeout) const; bool DoPost(MemoryBuffer& target, + HttpHeaders& answerHeaders, + size_t index, + const std::string& uri, + const std::string& body, + const HttpHeaders& headers, + unsigned int timeout) const; + + bool DoPost(MemoryBuffer& target, const std::string& name, const std::string& uri, const std::string& body, @@ -896,6 +904,14 @@ const std::string& body, const HttpHeaders& headers, unsigned int timeout) const; + + bool DoPost(Json::Value& target, + HttpHeaders& answerHeaders, + size_t index, + const std::string& uri, + const std::string& body, + const HttpHeaders& headers, + unsigned int timeout) const; bool DoPost(Json::Value& target, const std::string& name,