chihsuan commented on code in PR #11222:
URL: https://github.com/apache/ozone/pull/11222#discussion_r4072905178
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/SignedChunksInputStream.java:
##########
@@ -200,11 +225,14 @@ private boolean ensureChunkPayload() throws IOException {
return true;
}
if (remainingData == 0) {
- // final zero-byte chunk: verify it (empty payload) and stop reading
- if (validator != null) {
+ // The final zero-byte chunk has no payload terminator when trailing
headers follow it.
+ if (trailerHeader == null) {
readChunkTerminator();
}
validateChunk();
+ if (trailerHeader != null) {
+ validateTrailer();
Review Comment:
Should the trailer framing checks run when no validator is attached? The
chunk terminator and truncation checks stay lenient in that case, so the two
paths end up with different strictness.
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/SignedChunksInputStream.java:
##########
@@ -100,6 +107,9 @@ public class SignedChunksInputStream extends InputStream {
/** Signature parsed from the current chunk header line. */
private String chunkSignature;
+ /** Checksum header declared by x-amz-trailer, or null for a regular signed
stream. */
+ private final String trailerHeader;
Review Comment:
+1 on this. Would it be worth holding a set rather than a single value? That
would also cover the earlier point about `x-amz-trailer` listing several names,
without another signature change later.
--
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]