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

Incorrect comment for CURL_HTTP_VERSION_3 #519

Closed
jcamiel opened this issue Aug 8, 2023 · 3 comments · Fixed by #521
Closed

Incorrect comment for CURL_HTTP_VERSION_3 #519

jcamiel opened this issue Aug 8, 2023 · 3 comments · Fixed by #521

Comments

@jcamiel
Copy link
Contributor

jcamiel commented Aug 8, 2023

To use HTTP 3 we can use the following code:

self.handle.http_version(HttpVersion::V3);

HttpVersion::V3 is defined as as

/// Setting this value will make libcurl attempt to use HTTP/3 directly to
/// server given in the URL. Note that this cannot gracefully downgrade to
/// earlier HTTP version if the server doesn't support HTTP/3.
///
/// For more reliably upgrading to HTTP/3, set the preferred version to
/// something lower and let the server announce its HTTP/3 support via
/// Alt-Svc:.
///
/// (Added in CURL 7.66.0)
V3 = curl_sys::CURL_HTTP_VERSION_3 as isize,
}

And curl_sys::CURL_HTTP_VERSION_3 is defined here:

curl-rust/curl-sys/lib.rs

Lines 663 to 665 in ff6ad21

/// Makes use of explicit HTTP/3 without fallback.
/// (Added in CURL 7.66.0)
pub const CURL_HTTP_VERSION_3: c_int = 30;

The comment of this flag states that

Makes use of explicit HTTP/3 without fallback.

Whereas in curl.h the corresponding flag is defined

https://github.com/curl/curl/blob/9bca45dba81d77de06757ce13fc9193e09e010b5/include/curl/curl.h#L2272-L2274

/* Use HTTP/3, fallback to HTTP/2 or HTTP/1 if
needed. For HTTPS only. For HTTP, this option
makes libcurl return error. */

libcurl seems to fallback when using this flag whereas comments in crates curl imply that there is no fallback...

@sagebind
Copy link
Collaborator

sagebind commented Aug 8, 2023

Our doc comment was lifted straight from the libcurl man page, but it looks like it actually changed behaviors in version 7.88 when CURL_HTTP_VERSION_3ONLY was added: curl/curl@a56d2b0. When we initially added this, CURL_HTTP_VERSION_3 didn't allow any fallback.

But we can update this now. Maybe worth noting in the doc comment that the behavior varies between version >=7.66,<7.88 and >=7.88, depending on which version of libcurl you are linked to.

@jcamiel
Copy link
Contributor Author

jcamiel commented Aug 9, 2023

I can propose a PR with an updated comment if that help,

@jcamiel
Copy link
Contributor Author

jcamiel commented Aug 10, 2023

PR here => #521 (relevant curl PR is curl/curl#10264)

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 a pull request may close this issue.

2 participants