comparison Plugins/Engine/OrthancPlugins.cpp @ 4086:4cd94ed75a5b

issue #182: Better handling of errors in plugins reading chunked HTTP body
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Jun 2020 09:18:30 +0200
parents e42f5445d20d
children
comparison
equal deleted inserted replaced
4085:da06381f3091 4086:4cd94ed75a5b
5129 OrthancPluginServerChunkedRequestReader* reader = NULL; 5129 OrthancPluginServerChunkedRequestReader* reader = NULL;
5130 5130
5131 OrthancPluginErrorCode errorCode = handler( 5131 OrthancPluginErrorCode errorCode = handler(
5132 &reader, matcher.GetFlatUri().c_str(), &converter.GetRequest()); 5132 &reader, matcher.GetFlatUri().c_str(), &converter.GetRequest());
5133 5133
5134 if (reader == NULL) 5134 if (errorCode != OrthancPluginErrorCode_Success)
5135 {
5136 throw OrthancException(static_cast<ErrorCode>(errorCode));
5137 }
5138 else if (reader == NULL)
5135 { 5139 {
5136 // The plugin has not created a reader for chunked body 5140 // The plugin has not created a reader for chunked body
5137 return false; 5141 return false;
5138 }
5139 else if (errorCode != OrthancPluginErrorCode_Success)
5140 {
5141 throw OrthancException(static_cast<ErrorCode>(errorCode));
5142 } 5142 }
5143 else 5143 else
5144 { 5144 {
5145 target.reset(new HttpServerChunkedReader(reader, callback->GetParameters(), GetErrorDictionary())); 5145 target.reset(new HttpServerChunkedReader(reader, callback->GetParameters(), GetErrorDictionary()));
5146 return true; 5146 return true;