Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 3392:ad434967a68c
renames
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Jun 2019 10:35:16 +0200 |
parents | a48d652f1500 |
children | 2cd0369a156f |
comparison
equal
deleted
inserted
replaced
3391:df0f1821b3de | 3392:ad434967a68c |
---|---|
974 } | 974 } |
975 }; | 975 }; |
976 | 976 |
977 | 977 |
978 | 978 |
979 class OrthancPlugins::ChunkedBody : public HttpClient::IChunkedBody | 979 class OrthancPlugins::HttpRequestBody : public HttpClient::IRequestChunkedBody |
980 { | 980 { |
981 private: | 981 private: |
982 const _OrthancPluginHttpClientChunkedBody& params_; | 982 const _OrthancPluginHttpClientChunkedBody& params_; |
983 PluginsErrorDictionary& errorDictionary_; | 983 PluginsErrorDictionary& errorDictionary_; |
984 | 984 |
985 public: | 985 public: |
986 ChunkedBody(const _OrthancPluginHttpClientChunkedBody& params, | 986 HttpRequestBody(const _OrthancPluginHttpClientChunkedBody& params, |
987 PluginsErrorDictionary& errorDictionary) : | 987 PluginsErrorDictionary& errorDictionary) : |
988 params_(params), | 988 params_(params), |
989 errorDictionary_(errorDictionary) | 989 errorDictionary_(errorDictionary) |
990 { | 990 { |
991 } | 991 } |
992 | 992 |
993 virtual bool ReadNextChunk(std::string& chunk) | 993 virtual bool ReadNextChunk(std::string& chunk) |
994 { | 994 { |
995 if (params_.bodyDone(params_.body)) | 995 if (params_.requestBodyIsDone(params_.requestBody)) |
996 { | 996 { |
997 return false; | 997 return false; |
998 } | 998 } |
999 else | 999 else |
1000 { | 1000 { |
1001 size_t size = params_.bodyChunkSize(params_.body); | 1001 size_t size = params_.requestBodyChunkSize(params_.requestBody); |
1002 | 1002 |
1003 chunk.resize(size); | 1003 chunk.resize(size); |
1004 | 1004 |
1005 if (size != 0) | 1005 if (size != 0) |
1006 { | 1006 { |
1007 const void* data = params_.bodyChunkData(params_.body); | 1007 const void* data = params_.requestBodyChunkData(params_.requestBody); |
1008 memcpy(&chunk[0], data, size); | 1008 memcpy(&chunk[0], data, size); |
1009 } | 1009 } |
1010 | 1010 |
1011 OrthancPluginErrorCode error = params_.bodyNext(params_.body); | 1011 OrthancPluginErrorCode error = params_.requestBodyNext(params_.requestBody); |
1012 | 1012 |
1013 if (error != OrthancPluginErrorCode_Success) | 1013 if (error != OrthancPluginErrorCode_Success) |
1014 { | 1014 { |
1015 errorDictionary_.LogError(error, true); | 1015 errorDictionary_.LogError(error, true); |
1016 throw OrthancException(static_cast<ErrorCode>(error)); | 1016 throw OrthancException(static_cast<ErrorCode>(error)); |
2249 { | 2249 { |
2250 throw OrthancException(ErrorCode_ParameterOutOfRange, | 2250 throw OrthancException(ErrorCode_ParameterOutOfRange, |
2251 "This plugin service is only allowed for PUT and POST HTTP requests"); | 2251 "This plugin service is only allowed for PUT and POST HTTP requests"); |
2252 } | 2252 } |
2253 | 2253 |
2254 ChunkedBody body(p, pimpl_->dictionary_); | 2254 HttpRequestBody body(p, pimpl_->dictionary_); |
2255 | 2255 |
2256 HttpClient client; | 2256 HttpClient client; |
2257 client.SetBody(body); | 2257 client.SetBody(body); |
2258 | 2258 |
2259 _OrthancPluginCallHttpClient2 converted; | 2259 _OrthancPluginCallHttpClient2 converted; |