Skip to content

Commit

Permalink
Fix #14, more comments about version compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Jul 23, 2024
1 parent c1f6fb8 commit 662c547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Easy.zig
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ pub fn bufferWriteCallback(ptr: [*c]c_char, size: c_uint, nmemb: c_uint, user_da
pub fn setCommonOpts(self: Self) !void {
if (self.ca_bundle) |bundle| {
// https://curl.se/libcurl/c/CURLOPT_CAINFO_BLOB.html
if (!c.CURL_AT_LEAST_VERSION(7, 81, 0)) {
// Different TLS backends might require higher verison of libcurl.
// BearSSL (since 7.79.0), mbedTLS (since 7.81.0), rustls (since 7.82.0), wolfSSL (since 8.2.0)
if (!c.CURL_AT_LEAST_VERSION(7, 77, 0)) {
return error.NoCaInfoBlobSupport;
}
const blob = c.curl_blob{
Expand Down
8 changes: 5 additions & 3 deletions src/util.zig
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ pub fn printLibcurlVersion() void {
pub fn has_parse_header_support() bool {
// `curl_header` is officially supported since 7.84.0.
// https://curl.se/libcurl/c/curl_easy_header.html
// https://ec.haxx.se/helpers/headerapi/index.html
return c.CURL_AT_LEAST_VERSION(7, 84, 0);
}

comptime {
// `curl_easy_reset` is only available since 7.12.0
if (!c.CURL_AT_LEAST_VERSION(7, 12, 0)) {
@compileError("Libcurl version must at least 7.12.0");
// `CURL_AT_LEAST_VERSION` is only available since 7.43.0
// https://curl.se/libcurl/c/symbols-in-versions.html
if (!c.CURL_AT_LEAST_VERSION(7, 43, 0)) {
@compileError("Libcurl version must at least 7.43.0");
}
}

Expand Down

0 comments on commit 662c547

Please sign in to comment.