CefURLRequest problem after CEF upgrade

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.

CefURLRequest problem after CEF upgrade

Postby rado » Thu Oct 31, 2019 9:34 am

It seems after I've upgraded from cef_binary_3.3497.1841.g7f37a0a_windows32 to cef_binary_78.2.9+g4907ec5+chromium-78.0.3904.70_windows32 the CefURLRequest started to ignore received cookies.
I make some navigation in browser, then I mage some request using CefURLRequest. The cookies received by browser navigation are correctly sent with my request, but cookies received in response are ignored (I've tried to modify existing cookie) so when I do next navigation either using browser or CefURLRequest, the old value of cookie is sent. Is it bug or some new behavior? What should I do to get new cookie value saved? Thank you.
rado
Expert
 
Posts: 145
Joined: Wed Oct 05, 2011 3:32 am

Re: CefURLRequest problem after CEF upgrade

Postby magreenblatt » Thu Oct 31, 2019 9:48 am

magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefURLRequest problem after CEF upgrade

Postby rado » Thu Oct 31, 2019 10:06 am

I've seen the that topic but I'm not sure I have the same problem. I'm not examining the headers programatically and jkum claims the cookies are sent on subsequent requests (but not in my case).
I'm afraid cookies are not saved but I'll try to read all cookies using CefCookieManager. But even it these will be there I have no idea what to do with them. It does not give much sense to me to set them back to CefCookieManager::SetCookie
rado
Expert
 
Posts: 145
Joined: Wed Oct 05, 2011 3:32 am

Re: CefURLRequest problem after CEF upgrade

Postby magreenblatt » Thu Oct 31, 2019 10:17 am

If you specify UR_FLAG_ALLOW_STORED_CREDENTIALS in the CefRequest passed to CefURLRequest::Create than any cookies returned with the response should be saved. What origin are you loading using the CefURLRequest? What origin are you connecting to afterwards, where the cookies are not being sent? Do the new cookie values show in DevTools?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefURLRequest problem after CEF upgrade

Postby magreenblatt » Thu Oct 31, 2019 10:23 am

Note that your CefBrowser and CefURLRequest also need to share the same CefRequestContext.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefURLRequest problem after CEF upgrade

Postby rado » Thu Oct 31, 2019 10:43 am

I'm setting the UR_FLAG_ALLOW_STORED_CREDENTIALS flag (I already did with older CEF version).
I'm creating CefURLRequest with context created as CefRequestContext::GetGlobalContext().
All requests are sent to the same HTTPS domain.
I am creating CefURLRequest inside CefResourceHandler::ProcessRequest to make request by my way (currently I'm not modifying it, just forwarding original data in CefResourceHandler::Read()).
In developer tools I can see only old cookie value set from browser request.
I've checked traffic in Fiddler so I saw that CefURLRequest sent saved cookie value and server have sent new value which was not saved.
rado
Expert
 
Posts: 145
Joined: Wed Oct 05, 2011 3:32 am

Re: CefURLRequest problem after CEF upgrade

Postby magreenblatt » Thu Oct 31, 2019 10:48 am

Can you try making the CefURLRequest outside of CefResourceHandler callbacks and see if that makes a difference?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefURLRequest problem after CEF upgrade

Postby rado » Thu Oct 31, 2019 1:24 pm

I've modified cefclient to make simplest test and it works as expected. I'll try to reconstruct my usage in cefclient
rado
Expert
 
Posts: 145
Joined: Wed Oct 05, 2011 3:32 am

Re: CefURLRequest problem after CEF upgrade

Postby rado » Sat Nov 02, 2019 3:31 pm

It seems I've found the problem. I was using the request from CefResourceHandler::ProcessRequest() directly setting the UR_FLAG_ALLOW_STORED_CREDENTIALS passing it to CefURLRequest::Create().
It was bad API using but somehow it worked in older API but it does not work in new API. In release build I'm using it just ignores the SetFlags. (In debug it fails).
Now I'm creating new request copying URL, method, headers, post data, I hope I'm not missing something.
rado
Expert
 
Posts: 145
Joined: Wed Oct 05, 2011 3:32 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 45 guests