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

Rewrite `proxy-chain`

szmarczak opened this issue · comments

There are some problems with the current implementation:

  • handler_base.js always attaches to the underlying socket, which is not necessary e.g. for normal HTTP requests
  • tunnels can be simplified (current logic in general is complex imo)
  • contains lots of legacy code such as this
  • some utils can be removed make use of what is available in Node.js 14 e.g. http.valdiateHeaderValue

The rewrite would be in 100% TypeScript.

@jancurn What do you think?

@szmarczak The proposed changes sound good, but altogether this would be quite a big change that wouldn't bring a direct benefit to users, and could potentially break some things. So perhaps it would make sense to do the changes sequentially rather than all at once, e.g. start with TypeScript, then remove the legacy code etc.? Also please discuss with @mnmkng the priority with respect to other projects

Since we would release the TS version as major, I think it would make sense to add other potentially breaking changes into that release. The question is, how long would the rewrite take if we were to do TS only and how long it would take if we were to do TS + all the upgrades. @szmarczak can you estimate it?

I think it make sense to do all of those as part of a single major bump (we do major bumps for TS rewrites just to be safe, there can be build complications if people use TS, as well as to allow some minor/internal BCs during the rewrite).

(ofc it should happen in separate PRs to make things more reviewable)

My thinking was it would be quite hard to review all these changes mixed into one giant PR. So ideally if we could review and ship the changes separately, even as alpha releases, it would make the review simpler.

Also, regarding "tunnels can be simplified", I'd be quite curious to see how.

My thinking was it would be quite hard to review all these changes mixed into one giant PR.

I agree, however if we were to simplify the tunnels then the server api would change as well etc. in the end it would become a giant PR too.

I think I can do most of this in two or three days.

When we did the previous TS rewrites, we also did it step-by-step. I think it would make sense to split the PRs into at least the four above-listed topics.

Ok, I'll try to rewrite it step by step then. Might take more time.

Giving it more time is fine, it will make reviewing much faster and feedback loop shorter.