steveloughran commented on code in PR #15428:
URL: https://github.com/apache/iceberg/pull/15428#discussion_r2892094989


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -309,6 +325,40 @@ public SdkHttpFullRequest sign(
   @Override
   public void close() throws Exception {}
 
+  /**
+   * Given a signing response from a server, extract the signed headers from 
the query parameters.
+   *
+   * @param response The signing response which contains the URI with signed 
headers.
+   * @return A list of signed header names.
+   */
+  @VisibleForTesting
+  static List<String> enumerateSignedHeaders(S3SignResponse response) {
+    String headerEnum = null;
+    final String query = response.uri().getQuery();
+    if (isNotEmpty(query)) {
+
+      Map<String, String> queryParams = 
Splitter.on('&').withKeyValueSeparator('=').split(query);
+      String signedHeaders = queryParams.get(SIGNED_HEADERS_QUERY_PARAMETER);
+
+      if (isNotEmpty(signedHeaders)) {
+        headerEnum = signedHeaders;
+      }
+    }
+    if (headerEnum == null) {
+      // nothing in the ? headers, look for it in response headers
+      final List<String> headers = response.headers().get(SIGNED_HEADERS);
+      if (headers != null) {
+        // there's an assumption here that there is only one.
+        headerEnum = headers.get(0);
+      }
+    }
+    if (headerEnum == null) {
+      LOG.warn("No signed headers found in response: {}", response);

Review Comment:
   let's not print the signature



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to