I want to connect my code to firebase with using libcurl library and read datas i have function like this
static size_t my_write(void* buffer, size_t size, size_t nmemb, void* param) {
std::string& text = *static_cast<std::string*>(param);
size_t totalsize = size * nmemb;
text.append(static_cast<char*>(buffer), totalsize);
return totalsize;
}
and I have main function such as
int main() {
std::string result;
CURL* curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl,CURLOPT_URL,"https://example-project-62811-default-rtdb.firebaseio.com/.json");
curl_easy_setopt(curl, CURLOPT_PROXY_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST |
CURLSSLOPT_NO_REVOKE);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,my_write);
curl_easy_setopt(curl,CURLOPT_WRITEDATA, &result);
curl_easy_setopt(curl,CURLOPT_VERBOSE, 1L);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (CURLE_OK != res) {
std::cerr << "CURL ERROR: " << res << "\n";
}
}
curl_global_cleanup();
std::cout << result << "\n\n";
}
the code is working fine on other apis like https://api.chucknorris.io and the error that i get for trying to connect firebase is
- Trying 35.201.97.85:443...
- Connected to example-project-62811-default-rtdb.firebaseio.com (35.201.97.85) port 443 (#0)
- schannel: next InitializeSecurityContext failed: Unknown error (0x80092013)
- Closing connection 0
- schannel: shutting down SSL/TLS connection with example-project-62811-default-rtdb.firebaseio.com port 443 CURL ERROR: 35
edit-1 i also tried to write run from command prompt and it gives me same error and when i add add --ssl-no-revoke to script it worked
curl https://example-project-62811-default-rtdb.firebaseio.com/.json --ssl-no-revoke
is working and then i tried to use this technique in my code
curl_easy_setopt(curl, CURLOPT_PROXY_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST |
CURLSSLOPT_NO_REVOKE);
but it didn't work how can i solve this problem ?