Mercurial > hg > orthanc-dicomweb
changeset 121:ae6026561f75 dev
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 21 Jun 2016 17:11:12 +0200 |
parents | c437335febbf |
children | fd547b351dce |
files | Orthanc/Core/ChunkedBuffer.cpp Orthanc/Core/ChunkedBuffer.h Orthanc/Core/WebServiceParameters.cpp Orthanc/Sdk-mainline/orthanc/OrthancCPlugin.h Plugin/StowRsClient.cpp |
diffstat | 5 files changed, 29 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Orthanc/Core/ChunkedBuffer.cpp Fri Jun 17 17:35:20 2016 +0200 +++ b/Orthanc/Core/ChunkedBuffer.cpp Tue Jun 21 17:11:12 2016 +0200 @@ -51,17 +51,19 @@ } - void ChunkedBuffer::AddChunk(const char* chunkData, + void ChunkedBuffer::AddChunk(const void* chunkData, size_t chunkSize) { if (chunkSize == 0) { return; } - - assert(chunkData != NULL); - chunks_.push_back(new std::string(chunkData, chunkSize)); - numBytes_ += chunkSize; + else + { + assert(chunkData != NULL); + chunks_.push_back(new std::string(reinterpret_cast<const char*>(chunkData), chunkSize)); + numBytes_ += chunkSize; + } }
--- a/Orthanc/Core/ChunkedBuffer.h Fri Jun 17 17:35:20 2016 +0200 +++ b/Orthanc/Core/ChunkedBuffer.h Tue Jun 21 17:11:12 2016 +0200 @@ -61,7 +61,7 @@ return numBytes_; } - void AddChunk(const char* chunkData, + void AddChunk(const void* chunkData, size_t chunkSize); void AddChunk(const std::string& chunk);
--- a/Orthanc/Core/WebServiceParameters.cpp Fri Jun 17 17:35:20 2016 +0200 +++ b/Orthanc/Core/WebServiceParameters.cpp Tue Jun 21 17:11:12 2016 +0200 @@ -43,7 +43,7 @@ { WebServiceParameters::WebServiceParameters() : advancedFormat_(false), - url_("http://localhost:8042/"), + url_("http://127.0.0.1:8042/"), pkcs11Enabled_(false) { }
--- a/Orthanc/Sdk-mainline/orthanc/OrthancCPlugin.h Fri Jun 17 17:35:20 2016 +0200 +++ b/Orthanc/Sdk-mainline/orthanc/OrthancCPlugin.h Tue Jun 21 17:11:12 2016 +0200 @@ -4931,7 +4931,8 @@ typedef struct { - OrthancPluginMemoryBuffer* target; + OrthancPluginMemoryBuffer* answerBody; + OrthancPluginMemoryBuffer* answerHeaders; uint16_t* httpStatus; OrthancPluginHttpMethod method; const char* url; @@ -4955,10 +4956,19 @@ * @brief Issue a HTTP call with full flexibility. * * Make a HTTP call to the given URL. The result to the query is - * stored into a newly allocated memory buffer. + * stored into a newly allocated memory buffer. The HTTP request + * will be done accordingly to the global configuration of Orthanc + * (in particular, the options "HttpProxy", "HttpTimeout", + * "HttpsVerifyPeers", "HttpsCACertificates", and "Pkcs11" will be + * taken into account). * * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). - * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer() (out argument). + * @param answerBody The target memory buffer (out argument). + * It must be freed with OrthancPluginFreeMemoryBuffer(). + * @param answerHeaders The target memory buffer for the HTTP headers in the answers (out argument). + * The answer headers are formatted as a JSON object (associative array). + * The buffer must be freed with OrthancPluginFreeMemoryBuffer(). + * This argument can be set to NULL if the plugin has no interest in the HTTP headers. * @param httpStatus The HTTP status after the execution of the request (out argument). * @param method HTTP method to be used. * @param url The URL of interest. @@ -4981,7 +4991,8 @@ **/ ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpClient( OrthancPluginContext* context, - OrthancPluginMemoryBuffer* target, + OrthancPluginMemoryBuffer* answerBody, + OrthancPluginMemoryBuffer* answerHeaders, uint16_t* httpStatus, OrthancPluginHttpMethod method, const char* url, @@ -5001,7 +5012,8 @@ _OrthancPluginCallHttpClient2 params; memset(¶ms, 0, sizeof(params)); - params.target = target; + params.answerBody = answerBody; + params.answerHeaders = answerHeaders; params.httpStatus = httpStatus; params.method = method; params.url = url;
--- a/Plugin/StowRsClient.cpp Fri Jun 17 17:35:20 2016 +0200 +++ b/Plugin/StowRsClient.cpp Tue Jun 21 17:11:12 2016 +0200 @@ -131,7 +131,9 @@ uint16_t status = 0; OrthancPluginMemoryBuffer answer; OrthancPluginErrorCode code = OrthancPluginHttpClient( - context_, &answer, &status, + context_, &answer, + NULL, /* No interest in the HTTP headers of the answer */ + &status, OrthancPluginHttpMethod_Post, url.c_str(), 3, headersKeys, headersValues, /* HTTP headers */