File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 */
810class 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 *
You can’t perform that action at this time.
0 commit comments