-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Provide http-config option for curl low-speed-limit/time #5957
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
28fb126
to
7ed4db1
Compare
7ed4db1
to
0279123
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Could documentation for this option also be added to src/doc
?
src/cargo/ops/registry.rs
Outdated
if let Some(s) = config.get::<Option<u32>>("http.low-speed-limit")? { | ||
return Ok(Some(s)); | ||
} | ||
Ok(Some(10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this always returns Some
, perhaps this could return CargoResult<u32>
and use .unwrap_or(10)
internally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the Option, but instead of unwrap_or I've set the default in the function. This way, everything is in one place.
src/cargo/ops/registry.rs
Outdated
handle.low_speed_limit(config_low_speed_limit)?; | ||
} | ||
if let Some(config_low_speed_time) = low_speed_time(config)? { | ||
handle.low_speed_time(config_low_speed_time)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this conflicts with http_timeout
below, but could it suffice to avoid configuring this manually and letting http_timeout
below configure it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I just didn't notice the option was configured with the http-timeout.
Fixes rust-lang#5717 low-speed-time was removed because the corresponding curl-option is already set via http.timeout. removed unnecessary Option.
@bors: r+ Thanks! |
📌 Commit d6cde29 has been approved by |
⌛ Testing commit d6cde29 with merge 19c865c341814e4eba60c834d35ca6ec5fa45001... |
💥 Test timed out |
@bors retry |
Provide http-config option for curl low-speed-limit/time Fixes #5717 Provides new override options for curl in Cargo http config-section. ``` [http] timeout = 2 low-speed-limit = 5 ``` Test with the following during crate-download `sudo tc qdisc add dev eth0 handle 1: root htb default 11 && sudo tc class add dev eth0 parent 1: classid 1:1 htb rate 8bps && sudo tc class add dev eth0 parent 1:1 classid 1:11 htb rate 8bps` Clear with `sudo tc qdisc del dev eth0 root`
☀️ Test successful - status-appveyor, status-travis |
@lostiniceland @alexcrichton I was taking a closer look at this and I was a little concerned. IIUC, this change makes it so that there is no timeout by default (aside from the 30sec connect timeout). If a download hangs midway, it will never time out. Is that intentional? (As a side note, the docs for |
@ehuss This change keeps the current behavior unless you specify the low-speed-limit. If you set it to 0, it will disable the check completely (see curl-doc). And yes, in this case the download can hang midway I guess. |
Maybe it's best mention the default in the docs rather than the disable. |
It is mentioned in the docs
|
I mean have it as |
True. Maybe changing the docs to a non-disabled option is better. |
@lostiniceland In the new code, if you don't specify a timeout, then |
Where? I see it defaulting to |
Thanks for the thorough review. The default low_speed_limit is set regardless of the timeout. So without any timeout a dropping connection should be canceled due to the limit 10bps, except you disable it with 0 It should be exactly as before, just that the default of 10 can be overridden. EDIT: created #5973 to fix the docs |
The
I'm talking about the |
Oh yes sorry @ehuss, that was my mistake missing that! @lostiniceland would you be willing to send a PR to re-add the default call to |
I will add this to #5973 |
Ok, thanks! |
Man I'm blind.. |
Fixes #5717
Provides new override options for curl in Cargo http config-section.
Test with the following during crate-download
sudo tc qdisc add dev eth0 handle 1: root htb default 11 && sudo tc class add dev eth0 parent 1: classid 1:1 htb rate 8bps && sudo tc class add dev eth0 parent 1:1 classid 1:11 htb rate 8bps
Clear with
sudo tc qdisc del dev eth0 root