Libcurl and CEF browser conflict on ssl request

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Libcurl and CEF browser conflict on ssl request

Postby kdkdkd9 » Mon Apr 18, 2016 10:20 am

I have application, which uses libcurl for network connection and libcef for rendering html.

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.
kdkdkd9
Newbie
 
Posts: 8
Joined: Mon Mar 07, 2016 8:27 am

Re: Libcurl and CEF browser conflict on ssl request

Postby ratin3 » Thu Apr 21, 2016 5:15 pm

I have a similar problem but it has to do with libgcrypt.so. The binary distribution of libcef.so tries to link with libgcrypt11.so but I have libgcrypt20.so on my system. Yours probably same with openssl version discrepencies. I guess time to build the binaries from scratch.
ratin3
Techie
 
Posts: 22
Joined: Wed Apr 20, 2016 1:15 pm

Re: Libcurl and CEF browser conflict on ssl request

Postby kdkdkd9 » Sat Apr 23, 2016 2:11 pm

You may be right, any idea how can I set openssl version? I build from scratch and don't see openssl settings in cef.gyp :(
kdkdkd9
Newbie
 
Posts: 8
Joined: Mon Mar 07, 2016 8:27 am

Re: Libcurl and CEF browser conflict on ssl request

Postby ratin3 » Mon Apr 25, 2016 1:57 pm

Have you tried building the binaries from source using the steps from https://bitbucket.org/chromiumembedded/ ... QuickStart or https://bitbucket.org/chromiumembedded/ ... ndBuilding ? I am pretty new to this, I am doing the same currently (the latter) and having some CUPS related compilation problems. I guess once the binaries are installed based on what you have on your system (cmake will detect those) , then it will be custom tailored for your system..
ratin3
Techie
 
Posts: 22
Joined: Wed Apr 20, 2016 1:15 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], NateAtReach and 51 guests