bkietz commented on a change in pull request #8261:
URL: https://github.com/apache/arrow/pull/8261#discussion_r494491830



##########
File path: cpp/src/arrow/filesystem/s3fs.cc
##########
@@ -459,6 +459,24 @@ class S3Client : public Aws::S3::S3Client {
   }
 };
 
+// In AWS SDK < 1.8, Aws::Client::ClientConfiguration is a bool.
+// In AWS SDK >= 1.8, it's a Aws::Client::FollowRedirectsPolicy scoped enum.
+static constexpr bool HaveLegacyFollowRedirects =
+    std::is_same<bool,
+                 
decltype(Aws::Client::ClientConfiguration().followRedirects)>::value;
+
+template <typename Config = Aws::Client::ClientConfiguration>
+void DisableRedirects(
+    typename std::enable_if<HaveLegacyFollowRedirects, Config*>::type config) {
+  config->followRedirects = false;
+}
+
+template <typename Config = Aws::Client::ClientConfiguration>
+void DisableRedirects(
+    typename std::enable_if<!HaveLegacyFollowRedirects, Config*>::type config) 
{
+  config->followRedirects = decltype(config->followRedirects)::NEVER;
+}
+

Review comment:
       Maybe a little better?
   ```suggestion
   // In AWS SDK < 1.8, Aws::Client::ClientConfiguration::followRedirects is a 
bool.
   void DisableRedirectsImpl(bool* followRedirects) { *followRedirects = false; 
}
   
   // In AWS SDK >= 1.8, it's a Aws::Client::FollowRedirectsPolicy scoped enum.
   template <typename PolicyEnum, PolicyEnum Never = PolicyEnum::NEVER>
   void DisableRedirectsImpl(PolicyEnum* followRedirects) { *followRedirects = 
Never; }
   
   void DisableRedirects(Config* c) {
     DisableRedirectsImpl(&c->followRedirects);
   }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to