Rustup: Add HTTP proxy support

Created on 6 May 2016  路  10Comments  路  Source: rust-lang/rustup

With hyper 0.9.2 you can call Client::with_http_proxy(host, port) to set up the HTTP proxy.
I'm not sure how I want to implement this yet, whether there are standard ways to indicate a proxy should be used or not. Whatever the solution it needs to work during the initial install as well as after installation.

cc https://github.com/rust-lang-nursery/rustup.rs/issues/344
cc @seanmonstar

help wanted

All 10 comments

Considering the typical rustup invocation is done the curl | sh way, I think the environment variables http_proxy and/or https_proxy are preferable as the same settings are honored by curl as well. Plus it's the _de facto_ standard way on Linux at least, so it's intuitive for the user.

We just need to pull the config from the environment and parse it, as a reference here's how curl does it.

This won't be in the initial release?

Since the switch to curl, this is actually supported in the same standard method that curl supports it now (e.g. standard env vars)

Solved by #532?

@lilianmoraru I don't quite consider it solved yet. Two things:

  • I'd like to verify that the env vars used by hyper are the same used by curl, and a quick googling did not lead me to a description of how the curl env vars work
  • I'd like the proxy support documented in the README

Unfortunately I still don't know much myself about how to use this feature.

curl environment variables: https://curl.haxx.se/docs/manpage.html heading "ENVIRONMENT":

The environment variables can be specified in lower case or upper case. The lower case version has precedence. http_proxy is an exception as it is only available in lower case.

http_proxy [protocol://][:port]

Sets the proxy server to use for HTTP.

HTTPS_PROXY [protocol://][:port]

Sets the proxy server to use for HTTPS.

hyper doesn't look for any environment variables. rustup would need to look for them, and enable the proxy settings on the Client itself.

Thanks @seanmonstar. The hyper backend for rustup defines a function for the HTTPS_PROXY and ALL_PROXY environment variables (which looks to work for either HTTP or HTTPS). Perhaps we should remove ALL_PROXY and add HTTP_PROXY, for just plain HTTP.

Ah, well I didn't copy the whole section. There is an ALL_PROXY variable for curl. And they specifically say that HTTP_PROXY is not available, only http_proxy.

Here's the rest of the section:

[url-protocol]_PROXY [protocol://][:port]

Sets the proxy server to use for [url-protocol], where the protocol is a protocol that curl supports and as specified in a URL. FTP, FTPS, POP3, IMAP, SMTP, LDAP etc.

ALL_PROXY [protocol://][:port]

Sets the proxy server to use if no protocol-specific proxy is set.

NO_PROXY

list of host names that shouldn't go through any proxy. If set to a asterisk '*' only, it matches all hosts.

The hyper backend now uses the same env vars as curl. Just waiting on docs.

Done. Thanks @inejge !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fenhl picture fenhl  路  4Comments

daboross picture daboross  路  4Comments

kornelski picture kornelski  路  3Comments

ghost picture ghost  路  3Comments

jimmycuadra picture jimmycuadra  路  4Comments