Search code examples
c#chromium-embeddedcefsharp

CEF sharp 3 retriving response headers


So Im still trying to find the feature (if it is there) in Cefsharp 3, where one can inspect the headers from the response of a request. In case its not there, is it because it is not there in CEF 3 ? and or, where should i start looking, if Im to implement it ?


Solution

  • This feature is not in CEF 3 yet. Here's the outstanding issue for it: https://code.google.com/p/chromiumembedded/issues/detail?id=515

    There is a workaround noted...

    There's no great way to filter response contents with CEF3 currently. You can use CefResourceHandler via CefRequestHandler::GetResourceHandler and execute the request/return the response contents yourself using CefURLRequest.

    ... however this workaround is not possible in CefSharp 3 because CefURLRequestClient and friends are not implemented.

    At this stage, depending on how comfortable you are with C++ you might consider:

    • contributing to the (C++) CEF project and implement the response filtering feature - this will be all C++.
    • contributing C# wrappers of CefURLRequestClient and friends to the CefSharp project - which is a combination of light C++ and C#.

    You might also be interested that there is a way to get HTTP headers in JavaScript, as long as you have initiated the request yourself using AJAX: Accessing the web page's HTTP Headers in JavaScript

    This type of solution could easily be done with CefSharp 3 by injecting JavaScript into the current page.