-
Notifications
You must be signed in to change notification settings - Fork 3
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
new low_speed_limit
and low_speed_time
options
#23
Conversation
The second commit reverts my change to the version number in Project.toml. I used that for testing purposes, but of course versioning should be up to the project maintainer :) |
This is relevant here also: JuliaLang/Downloads.jl#193 |
function set_connect_timeout(easy::Curl.Easy, timeout::Real) | ||
timeout >= 0 || | ||
throw(ArgumentError("timeout must be positive, got $timeout")) | ||
if timeout ≤ typemax(Clong) ÷ 1000 | ||
timeout_ms = round(Clong, timeout * 1000) | ||
Curl.setopt(easy, CURLOPT_CONNECTTIMEOUT_MS, timeout_ms) | ||
else | ||
timeout = timeout ≤ typemax(Clong) ? round(Clong, timeout) : Clong(0) | ||
Curl.setopt(easy, CURLOPT_CONNECTTIMEOUT, timeout) | ||
Curl.setopt(easy, CURLOPT_CONNECTTIMEOUT, Clong(0)) |
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.
This would disregard the specified timeout value. Was this intentional?
Ah, didn't notice the explanation here. Yes, this looks correct.
@manuelbb-upb are there any more changes to be done here? If not, maybe mark it ready? |
Closing, as these are most likely not needed. Ref: #22 (comment) |
This adds an upper limit to the connect timeout value that can be specified, to limit it to `typemax(Clong) ÷ 1000`. An `ArgumentError` is thrown if the value is out of range. This matches what libcurl expects [here](https://github.com/curl/curl/blob/4a8f6869db3a4ba7cd1bcb153c3d5b4298728afa/lib/setopt.c#L1376). Originally reported at JuliaLang/Downloads.jl#193 and #23.
This adds an upper limit to the connect timeout value that can be specified, to limit it to `typemax(Clong) ÷ 1000`. An `ArgumentError` is thrown if the value is out of range. This matches what libcurl expects [here](https://github.com/curl/curl/blob/4a8f6869db3a4ba7cd1bcb153c3d5b4298728afa/lib/setopt.c#L1376). Originally reported at JuliaLang/Downloads.jl#193 and #23.
This is what I came up with to circumvent issue #22
Both options default to 0 in accordance with the corresponding Curl options.