apify / proxy-chain

Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.

Home Page:https://www.npmjs.com/package/proxy-chain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prepareRequestFunction() sometimes have request.socket.remoteAddress undefined

jancurn opened this issue · comments

When the client connection is closed too early, the request object passed to prepareRequestFunction() has socket.remoteAddress undefined, which can cause issues to users to the proxy-chain package. Since such connections are dead anyway, we should not pass them to prepareRequestFunction() and drop them right away.

For details why this happens, see nodejs/node#23858

Attempting to fix this in 3106aee, after the first check we cannot reliably detect socket close since the address is cached and socket.readyState is open.

Thanks!