TooTallNate/node-proxy-agent

Forever opened connection (easy to reproduce)

Debug295 opened this issue · 1 comments

There is #14 but I'm not sure if it same or not.
Steps to reproduce:
-Install netcat
-Do nc -l -v -p 8888 -L
-Launch code:

var http = require('http');
var ProxyAgent = require('proxy-agent');

// HTTP, HTTPS, or SOCKS proxy to use
var proxyUri = 'http://127.0.0.1:8888';

var opts = {
    method: 'GET',
    host: 'jsonip.org',
    path: '/',
    // this is the important part!
    agent: new ProxyAgent(proxyUri),
    timeout: 10000 // just in case it works
};

// the rest works just like any other normal HTTP request
http.get(opts, onresponse);

function onresponse(res) {
    console.log(res.statusCode, res.headers);
    res.pipe(process.stdout);
}

Result:
Script will connect and send GET http://jsonip.org/ HTTP/1.1 and nothing else will happen. Connection will stay open forever.
I am not good and JS so I can't found place where to fix this problem.
Or how can I manually close connection?

This code in this repository has been moved to the proxy-agents monorepo, so I am closing this pull request. If you feel that this issue still exists as of the latest release, feel free to open a new issue over there.