Mercurial > hg > orthanc
changeset 2023:7fe860db9664
rename
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 18 Jun 2016 10:05:47 +0200 |
parents | fefbe71c2272 |
children | 944b255035a0 |
files | Core/HttpClient.cpp Core/HttpClient.h |
diffstat | 2 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/HttpClient.cpp Fri Jun 17 17:09:50 2016 +0200 +++ b/Core/HttpClient.cpp Sat Jun 18 10:05:47 2016 +0200 @@ -298,7 +298,7 @@ } - static size_t CurlCallback(void *buffer, size_t size, size_t nmemb, void *payload) + static size_t CurlBodyCallback(void *buffer, size_t size, size_t nmemb, void *payload) { std::string& target = *(static_cast<std::string*>(payload)); @@ -331,7 +331,7 @@ throw OrthancException(ErrorCode_NotEnoughMemory); } - CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_WRITEFUNCTION, &CurlCallback)); + CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_WRITEFUNCTION, &CurlBodyCallback)); CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_HEADER, 0)); CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_FOLLOWLOCATION, 1)); @@ -436,7 +436,7 @@ } - bool HttpClient::Apply(std::string& answer) + bool HttpClient::ApplyInternal(std::string& answer) { answer.clear(); CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_URL, url_.c_str())); @@ -635,6 +635,12 @@ } + bool HttpClient::Apply(std::string& answer) + { + return ApplyInternal(answer); + } + + bool HttpClient::Apply(Json::Value& answer) { std::string s;
--- a/Core/HttpClient.h Fri Jun 17 17:09:50 2016 +0200 +++ b/Core/HttpClient.h Sat Jun 18 10:05:47 2016 +0200 @@ -69,6 +69,8 @@ void operator= (const HttpClient&); // Assignment forbidden HttpClient(const HttpClient& base); // Copy forbidden + bool ApplyInternal(std::string& answer); + public: HttpClient();