Skip to content

Commit e55999a

Browse files
committed
[Networking] Don't search for roots if we don't have CURLINFO_CAINFO.
`curl` versions before 7.84.0 don't have `CURLINFO_CAINFO`, so we can't tell whether they've got an existing path for the CA roots in that case. We should disable the automatic search in that case, because it would override the baked-in default. rdar://123434144
1 parent c62fb45 commit e55999a

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

CoreFoundation/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
411411
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.30.0"))
412412
add_compile_definitions($<$<COMPILE_LANGUAGE:C>:NS_CURL_MISSING_MAX_HOST_CONNECTIONS>)
413413
endif()
414+
415+
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.84.0"))
416+
add_compile_definitions($<$<COMPILE_LANGUAGE:C>:NS_CURL_MISSING_CURLINFO_CAINFO>)
417+
endif()
414418
endif()
415419

416420
add_framework(CFURLSessionInterface

CoreFoundation/URL.subproj/CFURLSessionInterface.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,9 @@ CFURLSessionInfo const CFURLSessionInfoFTP_ENTRY_PATH = { CURLINFO_FTP_ENTRY_PAT
586586
CFURLSessionInfo const CFURLSessionInfoREDIRECT_URL = { CURLINFO_REDIRECT_URL };
587587
CFURLSessionInfo const CFURLSessionInfoPRIMARY_IP = { CURLINFO_PRIMARY_IP };
588588
CFURLSessionInfo const CFURLSessionInfoAPPCONNECT_TIME = { CURLINFO_APPCONNECT_TIME };
589+
#if !NS_CURL_MISSING_CURLINFO_CAINFO
589590
CFURLSessionInfo const CFURLSessionInfoCAINFO = { CURLINFO_CAINFO };
591+
#endif
590592
CFURLSessionInfo const CFURLSessionInfoCERTINFO = { CURLINFO_CERTINFO };
591593
CFURLSessionInfo const CFURLSessionInfoCONDITION_UNMET = { CURLINFO_CONDITION_UNMET };
592594
CFURLSessionInfo const CFURLSessionInfoRTSP_SESSION_ID = { CURLINFO_RTSP_SESSION_ID };

Sources/FoundationNetworking/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
1515
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.30.0"))
1616
add_compile_definitions(NS_CURL_MISSING_MAX_HOST_CONNECTIONS)
1717
endif()
18+
19+
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.84.0"))
20+
add_compile_definitions(NS_CURL_MISSING_CURLINFO_CAINFO)
21+
endif()
1822
endif()
1923

2024
add_library(FoundationNetworking

Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ extension _EasyHandle {
209209
}
210210
#endif
211211

212+
#if !NS_CURL_MISSING_CURLINFO_CAINFO
212213
#if !os(Windows) && !os(macOS) && !os(iOS) && !os(watchOS) && !os(tvOS)
213214
// Check if there is a default path; if there is, it will already
214215
// be set, so leave things alone
@@ -240,7 +241,8 @@ extension _EasyHandle {
240241
return
241242
}
242243
}
243-
#endif
244+
#endif // !os(Windows) && !os(macOS) && !os(iOS) && !os(watchOS) && !os(tvOS)
245+
#endif // !NS_CURL_MISSING_CURLINFO_CAINFO
244246
}
245247

246248
/// Set allowed protocols

0 commit comments

Comments
 (0)