Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate cURL #1660

Merged
merged 3 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,16 @@ If you need a more complex setup, rustup supports the convention used by
the __curl__ program, documented in the ENVIRONMENT section of
[its manual page][curlman].

Note that some versions of `libcurl` apparently require you to drop the
`http://` or `https://` prefix in environment variables. For example,
`export http_proxy=proxy.example.com:1080` (and likewise for HTTPS).
The use of `curl` is presently **deprecated**, however it can still be used by
providing the `RUSTUP_USE_CURL` environment variable, for example:

```
RUSTUP_USE_CURL=1 rustup update
```

Note that some versions of `libcurl` apparently require you to drop the
`http://` or `https://` prefix in environment variables. For example,
`export http_proxy=proxy.example.com:1080` (and likewise for HTTPS).
If you are getting an SSL `unknown protocol` error from `rustup` via `libcurl`
but the command-line `curl` command works fine, this may be the problem.

Expand Down
2 changes: 1 addition & 1 deletion src/download/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT/Apache-2.0"

[features]

default = ["curl-backend"]
default = ["reqwest-backend"]

curl-backend = ["curl"]
reqwest-backend = ["reqwest", "env_proxy", "lazy_static"]
Expand Down
7 changes: 1 addition & 6 deletions src/rustup-utils/src/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub enum Notification<'a> {
ResumingPartialDownload,
UsingCurl,
das-sein marked this conversation as resolved.
Show resolved Hide resolved
UsingReqwest,
UsingHyperDeprecated,
}

impl<'a> Notification<'a> {
Expand All @@ -39,7 +38,7 @@ impl<'a> Notification<'a> {
| ResumingPartialDownload
| UsingCurl
| UsingReqwest => NotificationLevel::Verbose,
UsingHyperDeprecated | NoCanonicalPath(_) => NotificationLevel::Warn,
NoCanonicalPath(_) => NotificationLevel::Warn,
}
}
}
Expand All @@ -64,10 +63,6 @@ impl<'a> Display for Notification<'a> {
ResumingPartialDownload => write!(f, "resuming partial download"),
UsingCurl => write!(f, "downloading with curl"),
UsingReqwest => write!(f, "downloading with reqwest"),
UsingHyperDeprecated => f.write_str(
"RUSTUP_USE_HYPER environment variable is deprecated,\
use RUSTUP_USE_REQWEST instead",
),
}
}
}
14 changes: 4 additions & 10 deletions src/rustup-utils/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ pub fn download_file_with_resume(
}
}

static DEPRECATED_HYPER_WARNED: AtomicBool = ATOMIC_BOOL_INIT;

fn download_file_(
url: &Url,
path: &Path,
Expand Down Expand Up @@ -206,15 +204,11 @@ fn download_file_(
// Download the file

// Keep the hyper env var around for a bit
let use_hyper_backend = env::var_os("RUSTUP_USE_HYPER").is_some();
if use_hyper_backend && DEPRECATED_HYPER_WARNED.swap(true, Ordering::Relaxed) {
notify_handler(Notification::UsingHyperDeprecated);
}
let use_reqwest_backend = use_hyper_backend || env::var_os("RUSTUP_USE_REQWEST").is_some();
let (backend, notification) = if use_reqwest_backend {
(Backend::Reqwest, Notification::UsingReqwest)
} else {
let use_curl_backend = env::var_os("RUSTUP_USE_CURL").is_some();
let (backend, notification) = if use_curl_backend {
(Backend::Curl, Notification::UsingCurl)
} else {
(Backend::Reqwest, Notification::UsingReqwest)
};
notify_handler(notification);
download_to_path_with_backend(backend, url, path, resume_from_partial, Some(callback))?;
Expand Down