# HG changeset patch # User Sebastien Jodogne # Date 1593155910 -7200 # Node ID 4cd94ed75a5bac85057cc77b58177fa0c6a4e9c6 # Parent da06381f3091a6678723dd6ce149beddecb6944b Issue #182: Better handling of errors in plugins reading chunked HTTP body diff -r da06381f3091 -r 4cd94ed75a5b NEWS --- a/NEWS Thu Jun 25 15:11:41 2020 +0200 +++ b/NEWS Fri Jun 26 09:18:30 2020 +0200 @@ -10,6 +10,11 @@ * New functions in the SDK: - new "changes": JobSubmitted, JobSuccess, JobFailure +Maintenance +----------- + +* Issue #182: Better handling of errors in plugins reading chunked HTTP body + Version 1.7.1 (2020-05-27) ========================== diff -r da06381f3091 -r 4cd94ed75a5b Plugins/Engine/OrthancPlugins.cpp --- a/Plugins/Engine/OrthancPlugins.cpp Thu Jun 25 15:11:41 2020 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Fri Jun 26 09:18:30 2020 +0200 @@ -5131,15 +5131,15 @@ OrthancPluginErrorCode errorCode = handler( &reader, matcher.GetFlatUri().c_str(), &converter.GetRequest()); - if (reader == NULL) + if (errorCode != OrthancPluginErrorCode_Success) + { + throw OrthancException(static_cast(errorCode)); + } + else if (reader == NULL) { // The plugin has not created a reader for chunked body return false; } - else if (errorCode != OrthancPluginErrorCode_Success) - { - throw OrthancException(static_cast(errorCode)); - } else { target.reset(new HttpServerChunkedReader(reader, callback->GetParameters(), GetErrorDictionary()));