Skip to content

Commit

Permalink
feat: add inflate-deflate support (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
rentallect authored Mar 4, 2024
1 parent e6069f8 commit 5f89d57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/http/readable-stream/_stream_passthrough.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ class PassThrough extends Transform {
constructor (options) {
super(options);
this.ee = new EventEmitter();
if (options.headers && options.headers['content-encoding'] && isEqual(options.headers['content-encoding'].toLowerCase(), 'gzip')) {
this.isGzip = true;
this.inflator = new pako.Inflate();
if (options.headers) {
if (options.headers['content-encoding']) {
if (
isEqual(options.headers['content-encoding'].toLowerCase(), 'gzip') ||
isEqual(options.headers['content-encoding'].toLowerCase(), 'deflate')
) {
this.isGzip = true;
this.inflator = new pako.Inflate();
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/http/ziti-inner-tls-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class ZitiInnerTLSSocket extends EventEmitter {
// ...then indicate we have a pending 'close' event. The 'close' event will be emitted by the ClientRequest
// when it runs and sees the need to emit the event. We need to defer/delay the emission of the 'close'
// event because it is possible that the data for this connection hasn't completed the decrypt flow yet,
// and thus the HTTP Response pqrsing logic hasn't run yet, and if we issue a 'close' before then, the
// and thus the HTTP Response parsing logic hasn't run yet, and if we issue a 'close' before then, the
// HTTP Response parsing logic will interpret the close as a 'socket hang up' error.

this._closeEventPending = true;
Expand Down

0 comments on commit 5f89d57

Please sign in to comment.