Mercurial > hg > orthanc
changeset 2104:58a0ee0b4be1
HttpClient::SetRedirectionFollowed
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 13 Oct 2016 15:12:46 +0200 |
parents | a89ca69ec1d1 |
children | d1bb4bbe9775 |
files | Core/HttpClient.cpp Core/HttpClient.h |
diffstat | 2 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/HttpClient.cpp Thu Oct 13 11:42:30 2016 +0200 +++ b/Core/HttpClient.cpp Thu Oct 13 15:12:46 2016 +0200 @@ -507,9 +507,18 @@ CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_NOBODY, 0L)); CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CUSTOMREQUEST, NULL)); CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_POSTFIELDS, NULL)); - CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_POSTFIELDSIZE, 0)); + CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_POSTFIELDSIZE, 0L)); CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_PROXY, NULL)); + if (redirectionFollowed_) + { + CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_FOLLOWLOCATION, 1L)); + } + else + { + CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_FOLLOWLOCATION, 0L)); + } + // Set timeouts if (timeout_ <= 0) {
--- a/Core/HttpClient.h Thu Oct 13 11:42:30 2016 +0200 +++ b/Core/HttpClient.h Thu Oct 13 15:12:46 2016 +0200 @@ -67,6 +67,7 @@ std::string clientCertificateKeyPassword_; bool pkcs11Enabled_; bool headersToLowerCase_; + bool redirectionFollowed_; void Setup(); @@ -243,6 +244,16 @@ return headersToLowerCase_; } + void SetRedirectionFollowed(bool follow) + { + redirectionFollowed_ = follow; + } + + bool IsRedirectionFollowed() const + { + return redirectionFollowed_; + } + static void GlobalInitialize(); static void GlobalFinalize();