Skip to content

Commit

Permalink
Update to 8.10.0 (#571)
Browse files Browse the repository at this point in the history
* Update to 8.10.0

* 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.

* 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.

* Fix bindings for `curl_version_info_data`

---------

Co-authored-by: Alex Crichton <alex@alexcrichton.com>
  • Loading branch information
ehuss and alexcrichton authored Sep 11, 2024
1 parent 0622181 commit 226030a
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 43 deletions.
2 changes: 1 addition & 1 deletion curl-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <alex@alexcrichton.com>"]
links = "curl"
build = "build.rs"
Expand Down
3 changes: 2 additions & 1 deletion curl-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion curl-sys/curl
Submodule curl updated 1052 files
26 changes: 15 additions & 11 deletions curl-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -665,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;
Expand Down Expand Up @@ -871,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 {
Expand Down Expand Up @@ -901,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;
Expand Down
71 changes: 43 additions & 28 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ fn main() {
let version = version
.lines()
.find(|l| !l.is_empty() && !l.starts_with('#'))
.and_then(|s| s.parse::<u32>().ok())
.unwrap_or(10000);
println!("got version: {}", version);
.and_then(|s| {
let mut parts = s.split_whitespace();
let major = parts.next()?.parse::<u32>().ok()?;
let minor = parts.next()?.parse::<u32>().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'
Expand All @@ -39,20 +44,21 @@ 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());
cfg.skip_type(|n| n == "__enum_ty");
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,
_ => {}
Expand All @@ -64,13 +70,22 @@ 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_ELEVENTH" | "CURLVERSION_NOW" => return true,
"CURLVERSION_TWELFTH"
| "CURLVERSION_NOW"
| "CURLOPT_WRITEINFO"
| "CURLOPT_CLOSEPOLICY" => return true,
_ => {}
}
}
if version < 77 {
if version < (7, 87) {
match s {
"CURLVERSION_ELEVENTH" => return true,
_ => {}
}
}
if version < (7, 77) {
match s {
"CURLVERSION_TENTH"
| "CURLOPT_CAINFO_BLOB"
Expand All @@ -84,29 +99,29 @@ fn main() {
_ => {}
}
}
if version < 76 {
if version < (7, 76) {
match s {
"CURLOPT_DOH_SSL_VERIFYHOST" => return true,
"CURLOPT_DOH_SSL_VERIFYPEER" => return true,
"CURLOPT_DOH_SSL_VERIFYSTATUS" => return true,
_ => {}
}
}
if version < 75 {
if version < (7, 75) {
match s {
"CURLAUTH_AWS_SIGV4" => return true,
"CURLOPT_AWS_SIGV4" => return true,
"CURLVERSION_NINTH" => return true,
_ => {}
}
}
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"
Expand All @@ -122,7 +137,7 @@ fn main() {
_ => {}
}
}
if version < 70 {
if version < (7, 70) {
match s {
"CURL_VERSION_HTTP3"
| "CURL_VERSION_BROTLI"
Expand All @@ -131,32 +146,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,
Expand All @@ -169,35 +184,35 @@ 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
}
_ => {}
}
}
if version < 52 {
if version < (7, 52) {
match s {
"CURLOPT_PROXY_CAINFO"
| "CURLOPT_PROXY_CAPATH"
Expand All @@ -217,29 +232,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,
_ => {}
Expand Down
2 changes: 1 addition & 1 deletion systest/version_detect.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <curl/curlver.h>

LIBCURL_VERSION_MINOR
LIBCURL_VERSION_MAJOR LIBCURL_VERSION_MINOR

0 comments on commit 226030a

Please sign in to comment.