From 4dd8efba933e780152f60f68087189dab07e02a0 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 11 Sep 2024 07:40:11 -0700 Subject: [PATCH 1/4] Update to 8.10.0 --- curl-sys/Cargo.toml | 2 +- curl-sys/build.rs | 3 ++- curl-sys/curl | 2 +- curl-sys/lib.rs | 6 ++++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml index f875edeb9..e31bd44bb 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "curl-sys" -version = "0.4.74+curl-8.9.0" +version = "0.4.75+curl-8.10.0" authors = ["Alex Crichton "] links = "curl" build = "build.rs" diff --git a/curl-sys/build.rs b/curl-sys/build.rs index 0b4841045..14cfe0efb 100644 --- a/curl-sys/build.rs +++ b/curl-sys/build.rs @@ -100,7 +100,7 @@ fn main() { .replace("@LIBCURL_LIBS@", "") .replace("@SUPPORT_FEATURES@", "") .replace("@SUPPORT_PROTOCOLS@", "") - .replace("@CURLVERSION@", "8.9.0"), + .replace("@CURLVERSION@", "8.10.0"), ) .unwrap(); @@ -283,6 +283,7 @@ fn main() { // features, make sure we only compile one vtls. if cfg!(feature = "rustls") { cfg.define("USE_RUSTLS", None) + .file("curl/lib/vtls/cipher_suite.c") .file("curl/lib/vtls/rustls.c") .include(env::var_os("DEP_RUSTLS_FFI_INCLUDE").unwrap()); } else if cfg!(feature = "windows-static-ssl") { diff --git a/curl-sys/curl b/curl-sys/curl index 5040f7e94..a3bd1dda1 160000 --- a/curl-sys/curl +++ b/curl-sys/curl @@ -1 +1 @@ -Subproject commit 5040f7e94cd01decbe7ba8fdacbf489182d503dc +Subproject commit a3bd1dda12ec79cd63e0d81df4ec4b1fbbbcfa1b diff --git a/curl-sys/lib.rs b/curl-sys/lib.rs index 6dd56970c..803116972 100644 --- a/curl-sys/lib.rs +++ b/curl-sys/lib.rs @@ -414,7 +414,8 @@ pub const CURLOPT_TIMEVALUE: CURLoption = CURLOPTTYPE_LONG + 34; pub const CURLOPT_CUSTOMREQUEST: CURLoption = CURLOPTTYPE_OBJECTPOINT + 36; pub const CURLOPT_STDERR: CURLoption = CURLOPTTYPE_OBJECTPOINT + 37; pub const CURLOPT_POSTQUOTE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 39; -pub const CURLOPT_WRITEINFO: CURLoption = CURLOPTTYPE_OBJECTPOINT + 40; +#[deprecated = "has no effect"] +pub const CURLOPT_WRITEINFO: CURLoption = 9999; pub const CURLOPT_VERBOSE: CURLoption = CURLOPTTYPE_LONG + 41; pub const CURLOPT_HEADER: CURLoption = CURLOPTTYPE_LONG + 42; pub const CURLOPT_NOPROGRESS: CURLoption = CURLOPTTYPE_LONG + 43; @@ -442,7 +443,8 @@ pub const CURLOPT_MAXREDIRS: CURLoption = CURLOPTTYPE_LONG + 68; pub const CURLOPT_FILETIME: CURLoption = CURLOPTTYPE_LONG + 69; pub const CURLOPT_TELNETOPTIONS: CURLoption = CURLOPTTYPE_OBJECTPOINT + 70; pub const CURLOPT_MAXCONNECTS: CURLoption = CURLOPTTYPE_LONG + 71; -pub const CURLOPT_CLOSEPOLICY: CURLoption = CURLOPTTYPE_LONG + 72; +#[deprecated = "has no effect"] +pub const CURLOPT_CLOSEPOLICY: CURLoption = 9999; pub const CURLOPT_FRESH_CONNECT: CURLoption = CURLOPTTYPE_LONG + 74; pub const CURLOPT_FORBID_REUSE: CURLoption = CURLOPTTYPE_LONG + 75; pub const CURLOPT_RANDOM_FILE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 76; From 85b5147a3ca15243727758c6c5663bb94809d0d1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 11 Sep 2024 09:14:21 -0700 Subject: [PATCH 2/4] Fix version detection in `systest` Factor in both major/minor instead of just minor. This has been broken for awhile since the 8.0 release. --- systest/build.rs | 57 ++++++++++++++++++++++------------------ systest/version_detect.c | 2 +- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/systest/build.rs b/systest/build.rs index f92eaf596..6f78c66cd 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -15,9 +15,14 @@ fn main() { let version = version .lines() .find(|l| !l.is_empty() && !l.starts_with('#')) - .and_then(|s| s.parse::().ok()) - .unwrap_or(10000); - println!("got version: {}", version); + .and_then(|s| { + let mut parts = s.split_whitespace(); + let major = parts.next()?.parse::().ok()?; + let minor = parts.next()?.parse::().ok()?; + Some((major, minor)) + }) + .unwrap_or((10000, 0)); + println!("got version: {version:?}"); if env::var("TARGET").unwrap().contains("msvc") { cfg.flag("/wd4574"); // did you mean to use '#if INCL_WINSOCK_API_TYPEDEFS' @@ -46,13 +51,13 @@ fn main() { cfg.skip_signededness(|s| s.ends_with("callback") || s.ends_with("function")); cfg.skip_struct(move |s| { - if version < 71 { + if version < (7, 71) { match s { "curl_blob" => return true, _ => {} } } - if version < 87 { + if version < (8, 10) { match s { "curl_version_info_data" => return true, _ => {} @@ -70,7 +75,7 @@ fn main() { _ => {} } } - if version < 77 { + if version < (7, 77) { match s { "CURLVERSION_TENTH" | "CURLOPT_CAINFO_BLOB" @@ -84,7 +89,7 @@ fn main() { _ => {} } } - if version < 76 { + if version < (7, 76) { match s { "CURLOPT_DOH_SSL_VERIFYHOST" => return true, "CURLOPT_DOH_SSL_VERIFYPEER" => return true, @@ -92,7 +97,7 @@ fn main() { _ => {} } } - if version < 75 { + if version < (7, 75) { match s { "CURLAUTH_AWS_SIGV4" => return true, "CURLOPT_AWS_SIGV4" => return true, @@ -100,13 +105,13 @@ fn main() { _ => {} } } - if version < 72 { + if version < (7, 72) { match s { "CURLVERSION_EIGHTH" => return true, _ => {} } } - if version < 71 { + if version < (7, 71) { match s { "CURLOPT_SSLCERT_BLOB" | "CURLOPT_SSLKEY_BLOB" @@ -122,7 +127,7 @@ fn main() { _ => {} } } - if version < 70 { + if version < (7, 70) { match s { "CURL_VERSION_HTTP3" | "CURL_VERSION_BROTLI" @@ -131,32 +136,32 @@ fn main() { _ => {} } } - if version < 68 { + if version < (7, 68) { match s { "CURLSSLOPT_NO_PARTIALCHAIN" => return true, _ => {} } } - if version < 67 { + if version < (7, 67) { match s { "CURLMOPT_MAX_CONCURRENT_STREAMS" => return true, _ => {} } } - if version < 66 { + if version < (7, 66) { match s { "CURL_HTTP_VERSION_3" => return true, "CURLOPT_MAXAGE_CONN" => return true, _ => {} } } - if version < 65 { + if version < (7, 65) { match s { "CURLVERSION_SIXTH" => return true, _ => {} } } - if version < 64 { + if version < (7, 64) { match s { "CURLE_HTTP2" => return true, "CURLE_PEER_FAILED_VERIFICATION" => return true, @@ -169,27 +174,27 @@ fn main() { _ => {} } } - if version < 62 { + if version < (7, 62) { match s { "CURLOPT_DOH_URL" => return true, "CURLOPT_UPLOAD_BUFFERSIZE" => return true, _ => {} } } - if version < 61 { + if version < (7, 61) { match s { "CURLOPT_PIPEWAIT" => return true, "CURLE_PEER_FAILED_VERIFICATION" => return true, _ => {} } } - if version < 60 { + if version < (7, 60) { match s { "CURLVERSION_FIFTH" => return true, _ => {} } } - if version < 54 { + if version < (7, 54) { match s { "CURL_SSLVERSION_TLSv1_3" | "CURLOPT_PROXY_SSLCERT" | "CURLOPT_PROXY_SSLKEY" => { return true @@ -197,7 +202,7 @@ fn main() { _ => {} } } - if version < 52 { + if version < (7, 52) { match s { "CURLOPT_PROXY_CAINFO" | "CURLOPT_PROXY_CAPATH" @@ -217,29 +222,29 @@ fn main() { } } - if version < 49 { + if version < (7, 49) { match s { "CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE" | "CURLOPT_CONNECT_TO" => return true, _ => {} } } - if version < 47 { + if version < (7, 47) { if s.starts_with("CURL_HTTP_VERSION_2") { return true; } } - if version < 44 { + if version < (7, 44) { match s { "CURLMOPT_PUSHDATA" | "CURLMOPT_PUSHFUNCTION" => return true, _ => {} } } - if version < 43 { + if version < (7, 43) { if s.starts_with("CURLPIPE_") { return true; } } - if version < 25 { + if version < (7, 25) { match s { "CURLSSLOPT_ALLOW_BEAST" => return true, _ => {} diff --git a/systest/version_detect.c b/systest/version_detect.c index 260fc501b..ead762725 100644 --- a/systest/version_detect.c +++ b/systest/version_detect.c @@ -1,3 +1,3 @@ #include -LIBCURL_VERSION_MINOR +LIBCURL_VERSION_MAJOR LIBCURL_VERSION_MINOR From 93539aa02f346361971bdf49be08aaa16aea47aa Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 11 Sep 2024 09:14:56 -0700 Subject: [PATCH 3/4] Fix compilation against system libcurl for me Doesn't actually break the bindings since the underlying Rust type is still the same, but gets things running locally at least. --- curl-sys/lib.rs | 16 ++++++++-------- systest/build.rs | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/curl-sys/lib.rs b/curl-sys/lib.rs index 803116972..722757070 100644 --- a/curl-sys/lib.rs +++ b/curl-sys/lib.rs @@ -667,14 +667,14 @@ pub const CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE: c_int = 5; pub const CURL_HTTP_VERSION_3: c_int = 30; // Note that the type here is wrong, it's just intended to just be an enum. -pub const CURL_SSLVERSION_DEFAULT: CURLoption = 0; -pub const CURL_SSLVERSION_TLSv1: CURLoption = 1; -pub const CURL_SSLVERSION_SSLv2: CURLoption = 2; -pub const CURL_SSLVERSION_SSLv3: CURLoption = 3; -pub const CURL_SSLVERSION_TLSv1_0: CURLoption = 4; -pub const CURL_SSLVERSION_TLSv1_1: CURLoption = 5; -pub const CURL_SSLVERSION_TLSv1_2: CURLoption = 6; -pub const CURL_SSLVERSION_TLSv1_3: CURLoption = 7; +pub const CURL_SSLVERSION_DEFAULT: __enum_ty = 0; +pub const CURL_SSLVERSION_TLSv1: __enum_ty = 1; +pub const CURL_SSLVERSION_SSLv2: __enum_ty = 2; +pub const CURL_SSLVERSION_SSLv3: __enum_ty = 3; +pub const CURL_SSLVERSION_TLSv1_0: __enum_ty = 4; +pub const CURL_SSLVERSION_TLSv1_1: __enum_ty = 5; +pub const CURL_SSLVERSION_TLSv1_2: __enum_ty = 6; +pub const CURL_SSLVERSION_TLSv1_3: __enum_ty = 7; pub const CURLOPT_READDATA: CURLoption = CURLOPT_INFILE; pub const CURLOPT_WRITEDATA: CURLoption = CURLOPT_FILE; diff --git a/systest/build.rs b/systest/build.rs index 6f78c66cd..56e3a775d 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -44,6 +44,7 @@ fn main() { "curl_khtype" | "curl_khstat" | "curl_khmatch" => format!("enum {}", s), s if is_struct => format!("struct {}", s), "sockaddr" => "struct sockaddr".to_string(), + "__enum_ty" => "unsigned".to_string(), s => s.to_string(), }); // cfg.fn_cname(|s, l| l.unwrap_or(s).to_string()); From 461fafe9aa2b0381588de93472cb124392e78db3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 11 Sep 2024 09:15:29 -0700 Subject: [PATCH 4/4] Fix bindings for `curl_version_info_data` --- curl-sys/lib.rs | 4 +++- systest/build.rs | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/curl-sys/lib.rs b/curl-sys/lib.rs index 722757070..f71d99aa5 100644 --- a/curl-sys/lib.rs +++ b/curl-sys/lib.rs @@ -873,7 +873,8 @@ pub const CURLVERSION_EIGHTH: CURLversion = 7; pub const CURLVERSION_NINTH: CURLversion = 8; pub const CURLVERSION_TENTH: CURLversion = 9; pub const CURLVERSION_ELEVENTH: CURLversion = 10; -pub const CURLVERSION_NOW: CURLversion = CURLVERSION_ELEVENTH; +pub const CURLVERSION_TWELFTH: CURLversion = 11; +pub const CURLVERSION_NOW: CURLversion = CURLVERSION_TWELFTH; #[repr(C)] pub struct curl_version_info_data { @@ -903,6 +904,7 @@ pub struct curl_version_info_data { pub hyper_version: *const c_char, pub gsasl_version: *const c_char, pub feature_names: *const *const c_char, + pub rtmp_version: *const c_char, } pub const CURL_VERSION_IPV6: c_int = 1 << 0; diff --git a/systest/build.rs b/systest/build.rs index 56e3a775d..a9527a0dd 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -70,9 +70,18 @@ fn main() { // Version symbols are extracted from https://curl.se/libcurl/c/symbols-in-versions.html cfg.skip_const(move |s| { - if version < 87 { + if version < (8, 10) { + match s { + "CURLVERSION_TWELFTH" + | "CURLVERSION_NOW" + | "CURLOPT_WRITEINFO" + | "CURLOPT_CLOSEPOLICY" => return true, + _ => {} + } + } + if version < (7, 87) { match s { - "CURLVERSION_ELEVENTH" | "CURLVERSION_NOW" => return true, + "CURLVERSION_ELEVENTH" => return true, _ => {} } }