From fd46e25b296dcb9063c413f567cc4641096396d3 Mon Sep 17 00:00:00 2001 From: shamiao Date: Wed, 2 Dec 2020 13:13:29 +0800 Subject: [PATCH] add PowerShell to proxies docs. (some minor arrangements are also made.) --- doc/src/network-proxies.md | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/src/network-proxies.md b/doc/src/network-proxies.md index 1663b4b409..dead171aa4 100644 --- a/doc/src/network-proxies.md +++ b/doc/src/network-proxies.md @@ -3,18 +3,23 @@ Enterprise networks often don't have direct outside HTTP access, but enforce the use of proxies. If you're on such a network, you can request that `rustup` uses a proxy by setting its URL in the environment. In most cases, setting -`https_proxy` should be sufficient. On a Unix-like system with a shell like -__bash__ or __zsh__, you could use: - -```bash -export https_proxy=socks5://proxy.example.com:1080 # or http://proxy.example.com:8080 -``` - -On Windows, the command would be: - -```cmd -set https_proxy=socks5://proxy.example.com:1080 -``` +`https_proxy` should be sufficient. Commands may differ between different +systems and shells: + + - On a Unix-like system with a shell like __bash__ or __zsh__: + ```bash + export https_proxy=socks5://proxy.example.com:1080 + ``` + - On Windows [__Command Prompt (cmd)__][cmd]: + ```cmd + set https_proxy=socks5://proxy.example.com:1080 + ``` + - On Windows [__PowerShell__][ps] (or __PowerShell Core__): + ```cmd + $env:https_proxy="socks5://proxy.example.com:1080" + ``` + - Replace `socks5://proxy.example.com:1080` with + `http://proxy.example.com:8080` when an HTTP proxy is used instead. If you need a more complex setup, `rustup` supports the convention used by the __curl__ program, documented in the ENVIRONMENT section of [its manual @@ -34,3 +39,5 @@ getting an SSL `unknown protocol` error from `rustup` via `libcurl` but the command-line `curl` command works fine, this may be the problem. [curlman]: https://curl.haxx.se/docs/manpage.html +[cmd]: https://en.wikipedia.org/wiki/Cmd.exe +[ps]: https://en.wikipedia.org/wiki/PowerShell