TooTallNate / node-proxy-agent

Maps proxy protocols to `http.Agent` implementations
285 stars 69 forks source link

Forever opened connection (easy to reproduce) #53

Closed Debug295 closed 1 year ago

Debug295 commented 4 years ago

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?

TooTallNate commented 1 year ago

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.