denoland / deno

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

Support AUTOMATIC_PROXY in HTTP_PROXY and HTTPS_PROXY env vars #16070

Open bjesuiter opened 1 year ago

bjesuiter commented 1 year ago

I have a problem running deno upgrade on windows.

When I run deno upgrade i get the following error:

Looking up latest version
error: error sending request for url (https://github.com/denoland/deno/releases/latest): error trying to connect: tcp connect error: Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig. (os error 10013)

Caused by:
    0: error trying to connect: tcp connect error: Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig. (os error 10013)
    1: tcp connect error: Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig. (os error 10013)
    2: Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig. (os error 10013)

I suspect, this has to do with my restricted environment behind a corporate proxy and without UAC Permissions. However, it worked with some deno version before 1.24.3, which is my current deno version.

bjesuiter commented 1 year ago

Unfortunately, this issue is still present :/

bjesuiter commented 1 year ago

New Update:

I had HTTP_PROXY and HTTPS_PROXY set to another Env Var, named AUTOMATIC_PROXY, since I sometimes need to switch my proxy settings and wanted to do that easily.

Could you implement a recursive Env Var Resolution for HTTP_PROXY and HTTPS_PROXY?

kLiHz commented 7 months ago

I just checked Deno's manual and it looks like Deno will now fall back to reading proxies from registry on Windows when no corresponding environment variables are found (see Proxies). I'm not quite sure how your AUTOMATIC_PROXY works, but if you can update your proxies in Windows' system proxy settings, I think Deno might be able to use them when it runs.

By the way, I think it might be less maintainable for Deno to support (several) recursive env var looking up methods, while at the same time this functionality can be achieved with some efforts from the user/OS-side. On Windows it's just as above where the software can read settings from the system's registry (I think vcpkg and Python is doing similar things). And if you're using UNIX-like OS now, maybe run Deno with a prefix like HTTPS_PROXY=$AUTOMATIC_PROXY, or I think there are desktop environments that can set up HTTP_PROXYs for you in the terminal / we can let Deno read from those dektop environments' settings as it does on Windows.