Skip to content

Fix Glyph rendering issues#474

Closed
julien-duponchelle wants to merge 1 commit intodaijro:mainfrom
wiremind:encoding
Closed

Fix Glyph rendering issues#474
julien-duponchelle wants to merge 1 commit intodaijro:mainfrom
wiremind:encoding

Conversation

@julien-duponchelle
Copy link
Copy Markdown
Contributor

@julien-duponchelle julien-duponchelle commented Feb 1, 2026

The current patch was breaking the Dictionnary flow.

HTTP must stay different also using different accept encoding, so I'm applying the patch only when it's secure.

It's fix this rendering issue
image

Fix #473
Fix #464

The current patch was breaking the Dictionnary flow.

HTTP must stay different also using different accept encoding, so
I'm applying the patch only when it's secure.
@icepaq
Copy link
Copy Markdown
Collaborator

icepaq commented Feb 2, 2026

Hey @julien-duponchelle thanks for opening the PR!

If I understand correctly, the core issue is a configuration that the camoufox python library injects. Would it not be better to override the headers within the pip package?

Happy to hear your thoughts on this.

@julien-duponchelle
Copy link
Copy Markdown
Contributor Author

When you set the value in the Python library all call get intercepted and the HTTPS value is set.

This create two issue, the path where the header is set for HTTP is no longer called and the path where you get isDictionnary == true also is not called.

This header is controlled by three settings in Firefox:

pref("network.http.accept-encoding", "gzip, deflate");
pref("network.http.accept-encoding.secure", "gzip, deflate, br, zstd");
// dictionary compression is always only for secure connections
// Added to network.http.accept-encoding.secure
pref("network.http.accept-encoding.dictionary", "dcb, dcz");

We could also consider to remove the Accept Encoding override from the CPP code and override it via Firefox preference mechanism somewhere in the Python module.

@julien-duponchelle
Copy link
Copy Markdown
Contributor Author

@icepaq i could take a look if it's possible to strip the override from the CPP code and move to Python.

@KittisakPh
Copy link
Copy Markdown

thx due good luck

@julien-duponchelle
Copy link
Copy Markdown
Contributor Author

julien-duponchelle commented Feb 2, 2026

To make it easier to read:

Before my change:

nsresult nsHttpHandler::SetAcceptEncodings(const char* aAcceptEncodings,
                                           bool isSecure, bool isDictionary) {
    if (auto value = MaskConfig::GetString("headers.Accept-Encoding")) {
      mHttpsAcceptEncodings.Assign(nsCString(value.value().c_str()));
      return NS_OK;
    }
  if (isDictionary) {
    mDictionaryAcceptEncodings = aAcceptEncodings;
  } else if (isSecure) {
    mHttpsAcceptEncodings = aAcceptEncodings;
  } else {
    // use legacy list if a secure override is not specified
    mHttpAcceptEncodings = aAcceptEncodings;
    if (mHttpsAcceptEncodings.IsEmpty()) {
      mHttpsAcceptEncodings = aAcceptEncodings;
    }
  }

  return NS_OK;
}

After the change:

nsresult nsHttpHandler::SetAcceptEncodings(const char* aAcceptEncodings,
                                           bool isSecure, bool isDictionary) {
  if (isDictionary) {
    mDictionaryAcceptEncodings = aAcceptEncodings;
  } else if (isSecure) {
    if (auto value = MaskConfig::GetString("headers.Accept-Encoding")) {
      mHttpsAcceptEncodings.Assign(nsCString(value.value().c_str()));
      return NS_OK;
    }
    mHttpsAcceptEncodings = aAcceptEncodings;
  } else {
    mHttpAcceptEncodings = aAcceptEncodings;
    if (mHttpsAcceptEncodings.IsEmpty()) {
      mHttpsAcceptEncodings = aAcceptEncodings;
    }
  }

  return NS_OK;
}

@julien-duponchelle
Copy link
Copy Markdown
Contributor Author

You can check the behavior with a stock Firefox on https://echo.free.beeceptor.com/

HTTP protocol:
image

HTTPS:
image

@julien-duponchelle
Copy link
Copy Markdown
Contributor Author

I made another PR with different approach: #478

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glyph mapping failure(?) on some websites FF146 on MacOS

3 participants