Skip to content

Commit

Permalink
updog: remove reqwest proxy workaround
Browse files Browse the repository at this point in the history
We had a workaround for HTTPS_PROXY values that have no protocol. The
workaround is no longer needed because reqwest now does what we want.
  • Loading branch information
webern committed May 21, 2021
1 parent 911fb0b commit 207347d
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions sources/updater/updog/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,25 +471,6 @@ fn set_https_proxy_environment_variables(
_ => return Ok(()),
};

// TODO - remove this workaround, /~https://github.com/bottlerocket-os/bottlerocket/issues/1332
// reqwest needs a URL protocol scheme to be present, but other implementations assume
// `http://` as the scheme when none is present. We need to check the `HTTPS_PROXY` env and
// reset it with `http://` when no scheme is present. This workaround will no longer be needed
// when both bottlerocket and tough are using reqwest >= 0.11.1.
let proxy = if Url::parse(&proxy).is_ok() {
// the proxy value is OK, it has a scheme
debug!("setting HTTPS_PROXY={}", proxy);
proxy
} else {
// try prepending the default scheme
let prepended = format!("http://{}", proxy);
// now we expect a valid URL
let _ = Url::parse(&prepended).context(error::Proxy { proxy })?;
// now we know we have a string that will work with reqwest
debug!("prepended https:// and setting HTTPS_PROXY={}", prepended);
prepended
};

std::env::set_var("HTTPS_PROXY", &proxy);
if let Some(no_proxy) = no_proxy {
if !no_proxy.is_empty() {
Expand Down

0 comments on commit 207347d

Please sign in to comment.