Description: extend the versions of libcurl that can be used to build ffs . Minimal version supported by this patch is libcurl >= 7.66 . FreeFileSync makes an 'assert' that it supports all error codes of the curl version that it links to. Since FreeFileSync code is shipped to build with a specific version of curl, there is a hard coded assertion. . To avoid a build failure when curl is not in line with the one used upstream we make conditional checks on the curl version to determine which assertion should be made. . While this works fine to build with any old version of curl > 7.66, there will be a build fairure as soon as a new error code appears in a newer version of curl. In that case it is required to add it here. . Error codes can be found in the 'enum' named 'CURLcode' at https://github.com/curl/curl/blob/master/include/curl/curl.h . Author: Brulhart Author: bgstack15 Author: Fab Stz Origin: multiple sources Forwarded: https://freefilesync.org/forum/viewtopic.php?t=9687 Last-Update: 2024-06-23 --- a/libcurl/curl_wrap.cpp +++ b/libcurl/curl_wrap.cpp @@ -350,7 +350,11 @@ std::wstring zen::formatCurlStatusCode(C ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE46); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_TOO_MANY_REDIRECTS); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_UNKNOWN_OPTION); +#if LIBCURL_VERSION_NUM >= 0x074E00 // 7.78.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_SETOPT_OPTION_SYNTAX); +#else + ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_TELNET_OPTION_SYNTAX); +#endif ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE50); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE51); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_GOT_NOTHING); @@ -363,7 +367,11 @@ std::wstring zen::formatCurlStatusCode(C ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_SSL_CIPHER); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_PEER_FAILED_VERIFICATION); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_BAD_CONTENT_ENCODING); +#if LIBCURL_VERSION_NUM >= 0x075200 // 7.82.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE62); +#else + ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_LDAP_INVALID_URL); +#endif ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_FILESIZE_EXCEEDED); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_USE_SSL_FAILED); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_SEND_FAIL_REWIND); @@ -376,8 +384,16 @@ std::wstring zen::formatCurlStatusCode(C ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_TFTP_UNKNOWNID); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_REMOTE_FILE_EXISTS); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_TFTP_NOSUCHUSER); +#if LIBCURL_VERSION_NUM >= 0x075500 // 7.85.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE75); +#else + ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_CONV_FAILED); +#endif +#if LIBCURL_VERSION_NUM >= 0x075200 // 7.82.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE76); +#else + ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_CONV_REQD); +#endif ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_SSL_CACERT_BADFILE); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_REMOTE_FILE_NOT_FOUND); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_SSH); @@ -395,17 +411,51 @@ std::wstring zen::formatCurlStatusCode(C ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_SSL_INVALIDCERTSTATUS); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_HTTP2_STREAM); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_RECURSIVE_API_CALL); +#if LIBCURL_VERSION_NUM >= 0x074200 // 7.66.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_AUTH_ERROR); +#endif +#if LIBCURL_VERSION_NUM >= 0x074400 // 7.68.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_HTTP3); +#endif +#if LIBCURL_VERSION_NUM >= 0x074500 // 7.69.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_QUIC_CONNECT_ERROR); +#endif +#if LIBCURL_VERSION_NUM >= 0x074900 // 7.73.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_PROXY); +#endif +#if LIBCURL_VERSION_NUM >= 0x074D00 // 7.77.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_SSL_CLIENTCERT); +#endif +#if LIBCURL_VERSION_NUM >= 0x075400 // 7.84.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_UNRECOVERABLE_POLL); +#endif +#if LIBCURL_VERSION_NUM >= 0x080600 // 8.6.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_TOO_LARGE); +#endif +#if LIBCURL_VERSION_NUM >= 0x080800 // 8.8.0 ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_ECH_REQUIRED); +#endif ZEN_CHECK_CASE_FOR_CONSTANT(CURL_LAST); } +#if LIBCURL_VERSION_NUM >= 0x080800 // 8.8.0 static_assert(CURL_LAST == CURLE_ECH_REQUIRED + 1); +#elif LIBCURL_VERSION_NUM >= 0x080600 // 8.6.0 + static_assert(CURL_LAST == CURLE_TOO_LARGE + 1); +#elif LIBCURL_VERSION_NUM >= 0x075400 // 7.84.0 + static_assert(CURL_LAST == CURLE_UNRECOVERABLE_POLL + 1); +#elif LIBCURL_VERSION_NUM >= 0x074D00 // 7.77.0 + static_assert(CURL_LAST == CURLE_SSL_CLIENTCERT + 1); +#elif LIBCURL_VERSION_NUM >= 0x074900 // 7.73.0 + static_assert(CURL_LAST == CURLE_PROXY + 1); +#elif LIBCURL_VERSION_NUM >= 0x074500 // 7.69.0 + static_assert(CURL_LAST == CURLE_QUIC_CONNECT_ERROR + 1); +#elif LIBCURL_VERSION_NUM >= 0x074400 // 7.68.0 + static_assert(CURL_LAST == CURLE_HTTP3 + 1); +#elif LIBCURL_VERSION_NUM >= 0x074200 // 7.66.0 + static_assert(CURL_LAST == CURLE_AUTH_ERROR + 1); +#else + static_assert(CURL_LAST == CURLE_RECURSIVE_API_CALL + 1); +#endif return replaceCpy(L"Curl status %x", L"%x", numberTo(static_cast(sc))); }