[ 
https://issues.apache.org/jira/browse/HADOOP-18562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856063#comment-17856063
 ] 

ASF GitHub Bot commented on HADOOP-18562:
-----------------------------------------

PradhanPrerak commented on code in PR #6550:
URL: https://github.com/apache/hadoop/pull/6550#discussion_r1644804835


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/AWSClientConfig.java:
##########
@@ -407,6 +413,48 @@ private static void initSigner(Configuration conf,
     }
   }
 
+  /**
+   *
+   * @param conf hadoop configuration
+   * @param clientConfig client configuration to update
+   * @param awsServiceIdentifier service name
+   */
+  private static void initRequestHeaders(Configuration conf,
+      ClientOverrideConfiguration.Builder clientConfig, String 
awsServiceIdentifier) {
+    String configKey = null;
+    switch (awsServiceIdentifier) {
+      case AWS_SERVICE_IDENTIFIER_S3:
+        configKey = CUSTOM_HEADERS_S3;
+        break;
+      case AWS_SERVICE_IDENTIFIER_STS:
+        configKey = CUSTOM_HEADERS_STS;
+        break;
+      default:
+        // Nothing to do. The original signer override is already setup
+    }
+    if (configKey != null) {
+      String[] customHeaders = conf.getTrimmedStrings(configKey);
+      if (customHeaders == null || customHeaders.length == 0) {
+        LOG.debug("No custom headers specified");
+        return;
+      }
+
+      for (String customHeader : customHeaders) {

Review Comment:
   Thank you, I have revised the PR based on the feedback.
   >How do the s3 and STS stores react to unknown headers? What do they support 
today? I'm curious
   
   They ignore unknown headers. there are multiple use cases as mentioned 
[here](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html).
 One of the common use case I could think of is `Content-Type`, which is 
required for s3 write requests with body having html or something.
   





> New configuration for static headers to be added to all S3 requests
> -------------------------------------------------------------------
>
>                 Key: HADOOP-18562
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18562
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3
>            Reporter: Daniel Carl Jones
>            Priority: Minor
>              Labels: pull-request-available
>
> Some users have the use case where for a particular S3A filesystem, they 
> would like to set one or more headers to a static value.
> We might imagine a set of configurations properties with a common prefix, 
> where the suffix determines the header name and the value of the property 
> determines the value of the header.
> Per-filesystem headers can be set using the per-bucket configuration.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to