Skip to content

Accept-Language request header is not overridable #384

Description

@magreenblatt

Original report by Tim Lundqvist (Bitbucket: Tim Lundqvist).


What steps will reproduce the problem?

Trying to override Accept-Language in CefResourceRequestHandler.onBeforeResourceLoad is no longer possible as that value is ignored/overwritten for the actual request. A Java version of the scenario described here for plain CEF: https://magpcss.org/ceforum/viewtopic.php?f=6&t=17466.

Additionally the accept_language_list is not exposed on the CefSettings class, making it impossible to override the Accept-Language header.

What is the expected output? What do you see instead?

Whether or not the value of the Accept-Language request header is replaced in onBeforeResourceLoad the default value is used.

What version of the product are you using? On what operating system?

Currently I have only personally verified the issue for Windows on 4bb479a (CEF 83.4) and Mac on 5663a27 (CEF 84.3). But as stated in the forum post (linked above) this change in behavior occurred somewhere around version 79 (or at least in the high 70’s). And I see no reason as to this being different on any other OS for any affected version.

Proposed mitigation

Dynamic per-request selection of language is an edge case that shouldn’t be an issue for most implementations. As such, exposing the CefSettings.accept_language_list field and passing it on to CEF should be the preferred option. At least if there is no intention of supporting browser global headers such as Accept-Language and User-Agent to be overridable on a per-request basis.

Activity

  1. magreenblatt commented on Oct 14, 2020

    @magreenblatt
    CollaboratorAuthor

    Original comment by Tim Lundqvist (Bitbucket: Tim Lundqvist).


    I created a PR for the minimal mitigation: PR #65.

    Though configurating this on a per request basis is not necessary, having it be possible per CefBrowser instance should be doable? Only supporting language choice before initialize seems a bit strict. I have a WIP branch (feature/384-accept-language-browser) trying this out but I’ve run into an issue where setting CefBrowserSettings.accept_language_list in native doesn't seem to have any effect on what header value get sent. Is the field available for legacy reasons and not used, or do I have a misunderstanding of something crucial?

    ‌

  2. yusuke commented on Dec 11, 2023

    @yusuke

    I'm developing a browser for web developers and trying to implement a feature to make Accept-Language header configurable per tab. And I ended up with this issue. It appears there's already a PR for this. What is blocking the patch to be merged?

    https://bitbucket.org/TimLuqKase/java-cef/commits/40acab814575d6969ad1b67138c473556b645e8e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions