Skip to content

Commit e28cede

Browse files
committed
review william
1 parent 54c5ff8 commit e28cede

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

lib/auth/streamingV4/trailingChecksumTransform.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const { errors } = require('arsenal');
33

44
/**
55
* This class is designed to handle the chunks sent in a streaming
6-
* v4 Auth request
6+
* unsigned playload trailer request. In this iteration, we are not checking
7+
* the checksums, but we are removing them from the stream.
8+
* S3C-9732 will deal with checksum verification.
79
*/
810
class TrailingChecksumTransform extends Transform {
911
/**
@@ -19,6 +21,21 @@ class TrailingChecksumTransform extends Transform {
1921
this.streamClosed = false;
2022
}
2123

24+
/**
25+
* This function is executed when there is no more data to be read but before the stream is closed
26+
* We will verify that the trailing checksum structure was upheld
27+
*
28+
* @param {function} callback - Callback(err, data)
29+
* @return {function} executes callback with err if applicable
30+
*/
31+
_flush(callback) {
32+
if (!this.streamClosed) {
33+
this.log.error('stream ended without closing chunked encoding');
34+
return callback(errors.InvalidArgument);
35+
}
36+
return callback();
37+
}
38+
2239
/**
2340
* This function will remove the trailing checksum from the stream
2441
*

0 commit comments

Comments
 (0)