# HG changeset patch # User Sebastien Jodogne # Date 1476364366 -7200 # Node ID 58a0ee0b4be1cca8dc6cefae984d16cfdfb13bce # Parent a89ca69ec1d1dbd88194693c18ddb5b3978f363b HttpClient::SetRedirectionFollowed diff -r a89ca69ec1d1 -r 58a0ee0b4be1 Core/HttpClient.cpp --- 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) { diff -r a89ca69ec1d1 -r 58a0ee0b4be1 Core/HttpClient.h --- 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();