Skip to content

feat: add brotlicffi for Brotli HTTP compression support#2

Open
mikeNieto wants to merge 1 commit intovkfolio:masterfrom
mikeNieto:feat/add-brotlicffi-compression-support
Open

feat: add brotlicffi for Brotli HTTP compression support#2
mikeNieto wants to merge 1 commit intovkfolio:masterfrom
mikeNieto:feat/add-brotlicffi-compression-support

Conversation

@mikeNieto
Copy link
Copy Markdown

Summary

Add brotlicffi>=1.2.0.1 to requirements.txt to enable native Brotli (br) content-encoding support in the HTTP client.

Why

Many modern web servers advertise and prefer Brotli compression via the Accept-Encoding: br header. The httpx client (used during page extraction) will negotiate Brotli if the library is present — but without it, responses compressed with Brotli either fail to decode or fall back silently to gzip, resulting in garbled, incomplete, or empty extracted content.

What changes

File Change
requirements.txt Added brotlicffi>=1.2.0.1

Benefits

  • Better extraction quality: pages served with Brotli encoding are now decoded correctly, improving content quality for the extractor service.
  • Reduced bandwidth: Brotli typically achieves 15–25 % better compression ratios than gzip, lowering data transfer when fetching external URLs.
  • No breaking changes: the library is an optional transport-level dependency; existing behaviour is unchanged when servers do not advertise Brotli.
  • Cross-platform: brotlicffi uses CFFI bindings to the reference C library and ships pre-built wheels for all major platforms, so no extra system packages are required.

Testing

No code changes — dependency only. Existing test suite covers the extraction pipeline and should pass without modification.

Add brotlicffi>=1.2.0.1 as a dependency to enable Brotli content-encoding
support when fetching web pages during extraction. Many modern servers
negotiate Brotli (br) encoding via Accept-Encoding; without this library
the HTTP client silently falls back to gzip or fails to decode responses,
leading to garbled or empty content. brotlicffi provides a CFFI-based
binding to the reference Brotli C library, making it compatible with
any Python platform that supports CFFI.
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.

1 participant