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

new low_speed_limit and low_speed_time options #23

Closed
wants to merge 5 commits into from

Conversation

manuelbb-upb
Copy link

This is what I came up with to circumvent issue #22
Both options default to 0 in accordance with the corresponding Curl options.

@manuelbb-upb
Copy link
Author

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 :)

@manuelbb-upb
Copy link
Author

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))
Copy link
Member

@tanmaykm tanmaykm Jul 15, 2022

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.

@tanmaykm
Copy link
Member

@manuelbb-upb are there any more changes to be done here? If not, maybe mark it ready?

@tanmaykm
Copy link
Member

Closing, as these are most likely not needed. Ref: #22 (comment)

@tanmaykm tanmaykm closed this Jul 20, 2022
tanmaykm added a commit that referenced this pull request Jul 20, 2022
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.
tanmaykm added a commit that referenced this pull request Jul 20, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants