-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this.socket.destroy is not a function #81
Comments
I think it is caused by this https://github.com/TooTallNate/node-https-proxy-agent/blob/3.0.0/index.js#L171. To fix https://hackerone.com/reports/541502, a fake socket is now returned to the client if the proxy server does not respond with 200. I wonder if using a diff --git a/index.js b/index.js
index aeb624d..ea0a9f8 100644
--- a/index.js
+++ b/index.js
@@ -5,7 +5,7 @@
var net = require('net');
var tls = require('tls');
var url = require('url');
-var events = require('events');
+var stream = require('stream');
var Agent = require('agent-base');
var inherits = require('util').inherits;
var debug = require('debug')('https-proxy-agent');
@@ -168,7 +168,10 @@ HttpsProxyAgent.prototype.callback = function connect(req, opts, fn) {
//
// See: https://hackerone.com/reports/541502
socket.destroy();
- socket = new events.EventEmitter();
+ socket = new stream.Duplex({
+ read() {},
+ write() {}
+ });
// save a reference to the concat'd Buffer for the `onsocket` callback
buffers = buffered;
|
I have not been able to replicate this issue in isolation. Cannot deploy a patch to production. I have added it to local development, but I have not really seen this happen locally. |
Any plans on releasing this patch? |
…oxy errors (#83) * Run CI on pull requests * Use a `Duplex` instead of a plain `EventEmitter` Fixes: TooTallNate/proxy-agents#81 * Use a new and closed `net.Socket` instead of a `Duplex`
After upgrading to v3, I started to get errors:
So far I wasn't able to isolate what is causing them.
The text was updated successfully, but these errors were encountered: