better-https-proxy-agent
Advanced tools
Comparing version 1.0.7 to 1.0.8
25
index.js
@@ -113,3 +113,8 @@ 'use strict'; | ||
Agent.prototype._createSurrogateStream = function _createSurrogateStream(destroyer) { | ||
const stream = duplexify(); | ||
const stream = duplexify(null, null, { | ||
/* | ||
* Don't end the writable stream when the readable stream ends. | ||
*/ | ||
end: false | ||
}); | ||
@@ -188,12 +193,10 @@ stream.surrogateConnectedStream = null; | ||
* writable streams emits an error or close it will destroy both streams and | ||
* bubble up the event," on careful examination, `close` events only bubble | ||
* up and destroy the stream if they are 'premature', which means they occur | ||
* before an expected `end` event; `close` events are also emitted by the | ||
* 'duplexify' stream following an error. However, following an 'end' event, | ||
* no 'close' is emitted at all. Oops. We work around that problem here. | ||
* bubble up the event," this does not appear to be reliable, but I have been | ||
* unable to reproduce the situation using mocks. Propagate the events ourselves | ||
* to be safe. | ||
* | ||
* It also doesn't set writable to false when the stream is closed, even | ||
* 'duplexify' also doesn't set writable to false when the stream is closed, even | ||
* though it is no longer safe to call write(). We deal with that, too. | ||
*/ | ||
tlsSocket.once('end', connectedOnEnd); | ||
tlsSocket.once('error', connectedOnError); | ||
tlsSocket.once('close', connectedOnClose); | ||
@@ -334,4 +337,4 @@ }; | ||
function connectedOnEnd() { | ||
this.surrogateSeenEnd = true; | ||
function connectedOnError(error) { | ||
this.surrogateStream.emit('error', error); | ||
} | ||
@@ -341,5 +344,5 @@ | ||
this.surrogateStream.writable = false; | ||
if (this.surrogateSeenEnd) this.surrogateStream.emit('close'); | ||
this.surrogateStream.emit('close'); | ||
} | ||
module.exports.Agent = Agent; |
{ | ||
"name": "better-https-proxy-agent", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "An agent for HTTPS through an HTTP(S) proxy server using the CONNECT method", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253
15964