From 385f83cd55f1c7398251f5b325e30a4f71302e74 Mon Sep 17 00:00:00 2001 From: shirady <57721533+shirady@users.noreply.github.com> Date: Tue, 4 Feb 2025 21:41:11 +0200 Subject: [PATCH] remove log printings Signed-off-by: shirady <57721533+shirady@users.noreply.github.com> --- src/util/chunked_content_decoder.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/util/chunked_content_decoder.js b/src/util/chunked_content_decoder.js index 4dedd27cfe..c4c8dbfba7 100644 --- a/src/util/chunked_content_decoder.js +++ b/src/util/chunked_content_decoder.js @@ -52,7 +52,6 @@ class ChunkedContentDecoder extends stream.Transform { _flush(callback) { if (this.state !== STATE_CONTENT_END) return this.error_state(); - console.log('SDSD this.trailers', this.trailers); return callback(); } @@ -88,14 +87,9 @@ class ChunkedContentDecoder extends stream.Transform { */ /* eslint-disable max-statements */ parse(buf) { - console.log('SDSD JSON.stringify(buf.toString())', JSON.stringify(buf.toString())); - console.log('SDSD buf.length', buf.length); for (let index = 0; index < buf.length; ++index) { - console.log('SDSD (outer loop) index', index); if (this.state === STATE_READ_CHUNK_HEADER) { - console.log('SDSD this.state', this.state, 'index', index); for (; index < buf.length; ++index) { - console.log('SDSD (inner loop) index', index); if (buf[index] === CR_CODE) { const header_items = this.chunk_header_str.split(';'); this.chunk_size = parseInt(header_items[0], 16); @@ -105,7 +99,6 @@ class ChunkedContentDecoder extends stream.Transform { const header1 = header_items[1].split('='); this.chunk_signature = header1[0] === 'chunk-signature' ? header1[1] : ''; } - console.log('SDSD this.chunk_header_str', this.chunk_header_str); this.chunk_header_str = ''; this.state = STATE_WAIT_NL_HEADER; break; @@ -114,19 +107,13 @@ class ChunkedContentDecoder extends stream.Transform { } } } else if (this.state === STATE_WAIT_NL_HEADER) { - console.log('SDSD this.state', this.state, 'index', index); if (buf[index] !== NL_CODE) return this.error_state(); this.state = STATE_SEND_DATA; } else if (this.state === STATE_SEND_DATA) { - console.log('SDSD this.state', this.state, 'index', index); const content = (index === 0 && buf.length <= this.chunk_size) ? buf : buf.subarray(index, index + this.chunk_size); this.chunk_size -= content.length; - console.log('SDSD index before', index, this.state); index += content.length - 1; - console.log('SDSD index after', index, this.state); if (content.length) this.push(content); - console.log('SDSD this.chunk_size', this.chunk_size); - console.log('SDSD this.last_chunk', this.last_chunk); if (!this.chunk_size) { this.state = this.last_chunk ? STATE_READ_TRAILER_DATA : STATE_WAIT_CR_DATA; } @@ -138,23 +125,18 @@ class ChunkedContentDecoder extends stream.Transform { index -= 1; // stay at current index } } else if (this.state === STATE_WAIT_CR_DATA) { - console.log('SDSD this.state', this.state, 'index', index); if (buf[index] !== CR_CODE) return this.error_state(); this.state = STATE_WAIT_NL_DATA; } else if (this.state === STATE_WAIT_NL_DATA) { - console.log('SDSD this.state', this.state, 'index', index); if (buf[index] !== NL_CODE) return this.error_state(); - console.log('SDSD this.last_chunk', this.last_chunk); if (this.last_chunk) { this.state = STATE_CONTENT_END; } else { this.state = STATE_READ_CHUNK_HEADER; } } else if (this.state === STATE_READ_TRAILER_DATA) { - console.log('SDSD this.state', this.state, 'index', index); const start_trailer = index; for (; index < buf.length; ++index) { - console.log('SDSD (new inner loop) index', index); if (buf[index] === CR_CODE) { this.state = STATE_WAIT_NL_TRAILER; break; @@ -162,25 +144,19 @@ class ChunkedContentDecoder extends stream.Transform { this.chunk_trailer_str = buf.toString('utf8', start_trailer, index); } } else if (this.state === STATE_WAIT_NL_TRAILER) { - console.log('SDSD this.state', this.state, 'index', index); if (buf[index] !== NL_CODE) return this.error_state(); this.trailers.push(this.chunk_trailer_str); - console.log('SDSD this.chunk_trailer_str', this.chunk_trailer_str); this.state = STATE_CHECK_TRAILER; } else if (this.state === STATE_WAIT_NL_END) { - console.log('SDSD this.state', this.state, 'index', index); if (buf[index] !== NL_CODE) return this.error_state(); this.state = STATE_CONTENT_END; } else { - console.log('SDSD in else condition this.state', this.state); - console.log('SDSD', 'index', index); return this.error_state(); } } } error_state() { - console.log('SDSD in error_state this.state', this.state); this.state = STATE_ERROR; this.emit('error', new Error('problem in parsing aws-chunked data')); }