Skip to content

Commit 44fac89

Browse files
committed
explain the options curl passes to bootstrap
also fixes a discrepency where the rust side doesn't use -L must not be merged before rust-lang#129134 docs are only on the rust side, since duplicated prose has a tendancy to get out-of-sync, and also because there are talks of removing the python script all together eventually.
1 parent 56adf87 commit 44fac89

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/bootstrap/bootstrap.py

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ def _download(path, url, probably_big, verbose, exception):
115115
extra_flags = []
116116
if curl_version() > (7, 70):
117117
extra_flags = [ "--retry-all-errors" ]
118+
# options should be kept in sync with
119+
# src/bootstrap/src/core/download.rs
120+
# for consistency.
121+
# they are also more compreprensivly explained in that file.
118122
run(["curl", option] + extra_flags + [
119123
"-L", # Follow redirect.
120124
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds

src/bootstrap/src/core/download.rs

+17-2
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,35 @@ impl Config {
227227
fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) {
228228
println!("downloading {url}");
229229
// Try curl. If that fails and we are on windows, fallback to PowerShell.
230+
// options should be kept in sync with
231+
// src/bootstrap/src/core/download.rs
232+
// for consistency
230233
let mut curl = command("curl");
231234
curl.args([
235+
// follow redirect
236+
"-L",
237+
// timeout if speed is < 10 bytes/sec for > 30 seconds
232238
"-y",
233239
"30",
234240
"-Y",
235-
"10", // timeout if speed is < 10 bytes/sec for > 30 seconds
241+
"10",
242+
// timeout if cannot connect within 30 seconds
236243
"--connect-timeout",
237-
"30", // timeout if cannot connect within 30 seconds
244+
"30",
245+
// output file
238246
"-o",
239247
tempfile.to_str().unwrap(),
248+
// if there is an error, don't restart the download,
249+
// instead continue where it left off.
240250
"--continue-at",
241251
"-",
252+
// retry up to 3 times. note that this means a maximum of 4
253+
// attempts will be made, since the first attempt isn't a *re*try.
242254
"--retry",
243255
"3",
256+
// -S: show errors, even if -s is specified
257+
// -R: set timestamp of downloaded file to that of the server
258+
// -f: fail on non-ok http status
244259
"-SRf",
245260
]);
246261
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.

0 commit comments

Comments
 (0)