denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.08k stars 5.4k forks source link

Disabled http agent support #21436

Open bolekk opened 11 months ago

bolekk commented 11 months ago

Hi! I'm curious why this part of code was commented out when porting from Node? https://github.com/denoland/deno/blob/f29075ae4cf435032e410d582bdfa22b031e802c/ext/node/polyfills/http.ts#L542-L543

I'm trying to use a Node module that relies on http/https under the hood and I can't pass an 'options.agent' object to use a proxy instead of a direct connection.

What would it take to get this functionality back? Thanks!

kLiHz commented 11 months ago

I did a blame and looks like this part of code is introduced in https://github.com/denoland/deno/commit/867a6d30 (related PR https://github.com/denoland/deno/pull/19122). And I think it is more like a TO-DO rather than being "commented out", since it's in a file under "polyfills".

If you'd like web requests go under proxies, maybe setting up HTTP_PROXY and HTTPS_PROXY environment variables will help. See Proxies (from here).

bolekk commented 11 months ago

Thanks @kLiHz ! Unfortunately HTTP(S)_PROXY flags only affect module downloads and fetch() calls (according to your link and also a local test), not the method that http.ts is using to open connections.

Will you be open to accepting a PR where I basically uncomment that part and add a test? My only worry is that the original author @crowlKats saw some other reasons for keeping it out...

crowlKats commented 11 months ago

the only reason was that agent wasnt properly implemented at the time