rich7420 commented on code in PR #11222:
URL: https://github.com/apache/ozone/pull/11222#discussion_r4017469839


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/SignedChunksInputStream.java:
##########
@@ -113,8 +123,23 @@ public class SignedChunksInputStream extends InputStream {
   private boolean isFinalChunkEncountered = false;
 
   public SignedChunksInputStream(InputStream inputStream, String keyPath) {
+    this(inputStream, keyPath, null);
+  }
+
+  /**
+   * Creates a signed chunk stream.
+   *
+   * @param inputStream the encoded request body
+   * @param keyPath resource used in S3 errors
+   * @param trailerHeader the value of x-amz-trailer, or null when no trailer 
is expected
+   */
+  public SignedChunksInputStream(InputStream inputStream, String keyPath, 
String trailerHeader) {
     originalStream = inputStream;
     this.keyPath = keyPath;
+    this.trailerHeader = trailerHeader == null ? null : 
trailerHeader.trim().toLowerCase(Locale.ROOT);
+    if (this.trailerHeader != null && 
!CHECKSUM_TRAILER_PATTERN.matcher(this.trailerHeader).matches()) {
+      throw invalidBody("Invalid x-amz-trailer header");

Review Comment:
   thanks for the review



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