Skip to content

Commit 04ebb9d

Browse files
Googlera-maurice
authored andcommitted
Set libcurl ssl cert path on linux to allow proper verification of google https certificates. This fixes unit tests and firebase sdk api's to work on linux
PiperOrigin-RevId: 263243424
1 parent ab93921 commit 04ebb9d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

app/rest/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ if(MSVC)
5555
-DWIN32_LEAN_AND_MEAN
5656
CURL_STATICLIB=1
5757
)
58+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
59+
set(rest_additional_defines
60+
-DFIREBASE_SSL_CAPATH="/etc/ssl/certs"
61+
)
5862
else()
5963
set(rest_additional_defines)
6064
endif()

app/rest/transport_curl.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,11 @@ bool BackgroundTransportCurl::PerformBackground(Request* request) {
452452
CheckOk(curl_easy_setopt(curl_, CURLOPT_SSL_VERIFYPEER, 1L), "verify peer");
453453
CheckOk(curl_easy_setopt(curl_, CURLOPT_SSL_VERIFYHOST, 2L), "verify host");
454454

455+
#ifdef FIREBASE_SSL_CAPATH
456+
CheckOk(curl_easy_setopt(curl_, CURLOPT_CAPATH, FIREBASE_SSL_CAPATH),
457+
"CA Path");
458+
#endif
459+
455460
// Set callback functions.
456461
CheckOk(curl_easy_setopt(curl_, CURLOPT_HEADERFUNCTION, CurlHeaderCallback),
457462
"set http header callback");

0 commit comments

Comments
 (0)