Everything works fine, except one issue: if libcurl is used after libcef is initialized, https requests will take significant amount of time(more than one second).
Here is minimal code, which illustrates the problem:
- Code: Select all
#include <curl/curl.h>
#include <iostream>
#include "include/cef_app.h"
class MyCefApp: public CefApp
{
private:
IMPLEMENT_REFCOUNTING(MyCefApp);
};
int main()
{
CefMainArgs main_args;
CefRefPtr<CefApp> App = new MyCefApp();
CefExecuteProcess(main_args, App, NULL);
CefSettings settings;
CefInitialize(main_args, settings, App, NULL);
CURL *curl;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://google.com");
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_perform(curl);
double val;
curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &val);
std::cout<<"CURLINFO_APPCONNECT_TIME: "<<val<<" sec.";
curl_easy_cleanup(curl);
return 0;
}
Application output will be like:
CURLINFO_APPCONNECT_TIME: 1.29 sec.
But when line
- Code: Select all
CefInitialize(main_args, settings, App, NULL);
will be commented, or curl block will be placed before cef block, output will be like:
CURLINFO_APPCONNECT_TIME: 0.38 sec.
If I use non ssl version of google, problem disapears.
I use:
- Code: Select all
libcurl/7.48.0 OpenSSL/1.0.1s zlib/1.2.8
Libcurl built with
- Code: Select all
mode=dll VC=14 WITH_SSL=dll WITH_ZLIB=dll ENABLE_SSPI=no ENABLE_IPV6=yes ENABLE_IDN=no ENABLE_WINSSL=no GEN_PDB=no DEBUG=no MACHINE=x86
libcurl, openssl, zlib and libcef build with VS 2015 community eddition, on Windows 7.
CEF version is 3.2623.1393.g9e0fda8
I know, that libcef has its own class for making https reqests, but I need to use curl, because cef http client don't support socks 5 proxies with authentication.
Could you explian why ssl requests behaves like that?
Thanks.