Skip to content

Commit

Permalink
Fix semantic of HttpVersion::V3 for libcurl >= 7.88.0
Browse files Browse the repository at this point in the history
CURL_HTTP_VERSION_3, introduced in curl 7.66.0, has changed with curl 7.88.0. Prior 7.88.0, CURL_HTTP_VERSION_3 implies no fallback if error; since 7.88.0, CURL_HTTP_VERSION_3 can fallback to HTTP/1 or HTTP/2.
There is a new flag CURL_HTTP_VERSION_3_ONLY that doesn't fallback. See curl/curl#10264.
  • Loading branch information
jcamiel committed Aug 10, 2023
1 parent ff6ad21 commit e4b9bb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion curl-sys/lib.rs
Expand Up @@ -660,7 +660,7 @@ pub const CURL_HTTP_VERSION_2TLS: c_int = 4;
/// Please use HTTP 2 without HTTP/1.1 Upgrade
/// (Added in CURL 7.49.0)
pub const CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE: c_int = 5;
/// Makes use of explicit HTTP/3 without fallback.
/// Use HTTP/3, fallback to HTTP/2 or HTTP/1 if needed.
/// (Added in CURL 7.66.0)
pub const CURL_HTTP_VERSION_3: c_int = 30;

Expand Down
9 changes: 4 additions & 5 deletions src/easy/handler.rs
Expand Up @@ -453,12 +453,11 @@ pub enum HttpVersion {
V2PriorKnowledge = curl_sys::CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE as isize,

/// 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.
/// server given in the URL but fallback to earlier HTTP versions if the HTTP/3
/// connection establishment fails.
///
/// 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:.
/// Note: the meaning of this settings depends on the linked libcurl.
/// For CURL < 7.88.0, there is no fallback if HTTP/3 connection fails.
///
/// (Added in CURL 7.66.0)
V3 = curl_sys::CURL_HTTP_VERSION_3 as isize,
Expand Down

0 comments on commit e4b9bb9

Please sign in to comment.