Synchronous cookie store access - is it possible?

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

Synchronous cookie store access - is it possible?

Postby HarmlessDave » Thu Nov 19, 2015 3:19 pm

We are running into a problem interacting with a server that we do not control. It wants to set a security handshake challenge and then immediately look for the valid response.

With the IE web control, you can have a before navigate or document complete event check and update cookies synchronously, so the response is guaranteed to be there in the next request. With the aynch cookie visitor this might or might not happen in time.

Does chromium offer synchronous cookie access that CEF is not using because asynchronous is considered better, or is this something that could only be accomplished by hacking the chromium source?

Edit: this gets more complicated since navigation events are in the render process and the current cookie manager functions must be run in the browser process. Unless the render process could get direct access I guess this might require some duct tape and baling wire scheme like delaying all navigations while the cookie visitor is in progress. Ugly.
Last edited by HarmlessDave on Thu Nov 19, 2015 3:25 pm, edited 1 time in total.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Synchronous cookie store access - is it possible?

Postby magreenblatt » Thu Nov 19, 2015 3:23 pm

HarmlessDave wrote:Does chromium offer synchronous cookie access

No. You can look at the CookieMonster implementation for the full set of methods offered by Chromium.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Synchronous cookie store access - is it possible?

Postby HarmlessDave » Thu Nov 19, 2015 3:27 pm

magreenblatt wrote:
HarmlessDave wrote:Does chromium offer synchronous cookie access

No. You can look at the CookieMonster implementation for the full set of methods offered by Chromium.


Thanks - if we can't get the partner to update their server I guess we'll need to implement some kind of halt-and-wait scheme where we cache the next navigation and stop it until after CookieVisitor reaches its destructor.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Synchronous cookie store access - is it possible?

Postby magreenblatt » Thu Nov 19, 2015 5:32 pm

In modern CEF versions most requests can be continued asynchronously. You might want to see if that's an option for you.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Synchronous cookie store access - is it possible?

Postby HarmlessDave » Fri Nov 20, 2015 6:45 pm

magreenblatt wrote:In modern CEF versions most requests can be continued asynchronously. You might want to see if that's an option for you.


Can you explain in a little more detail? If I want to wait for the cookie visitor in CefRenderProcessHandler - OnBeforeNavigation( ) I can't think of a way to delay it except for caching the request, blocking the navigation by returning true, then having the CookieVisitor destructor re-issue the request.

Which gets tricky, because how do I know to let that second version go through without re-doing the cookie wait? The URL will not be unique in situations like posting back a form on a page to itself. Maybe by creating a hash from the request and storing it as already checked?

If there's a cleaner way to delay a navigation until after the cookie visitor destructor, it would be very helpful to know that.

Edit: we're using CEF 3.2272.1998
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Synchronous cookie store access - is it possible?

Postby magreenblatt » Fri Nov 20, 2015 7:02 pm

The OnBeforeResourceLoad method can be continued asynchronously in newer CEF versions. You could use that to delay the request until cookie info is retrieved.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 19 guests