ladybird icon indicating copy to clipboard operation
ladybird copied to clipboard

Meta: Patch curl to ignore all trailing bytes after end of zlib stream

Open Lubrsi opened this issue 4 months ago • 4 comments

Without this patch, curl errors on any trailing bytes after the end of a zlib stream. For web compatibility, we must ignore trailing bytes instead of erroring.

This matches Firefox and Chrome:

  • https://searchfox.org/firefox-main/rev/04cf27582307a9c351e991c740828d54cf786b76/netwerk/streamconv/converters/nsHTTPCompressConv.cpp#607-613
  • https://source.chromium.org/chromium/chromium/src/+/main:net/filter/gzip_source_stream.cc;l=240-250;drc=397107e399d4b0f4a6e801e7a888d7d71778529c;bpv=0;bpt=1

Fixes https://github.com/LadybirdBrowser/ladybird/issues/7091

Lubrsi avatar Dec 12 '25 19:12 Lubrsi

Hello!

One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why. Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

ladybird-bot avatar Dec 12 '25 19:12 ladybird-bot

patching curl for this seems awkward from a distribution point of view. For example, your quirk patch is not included in the flatpak build. third-party packaging from e.g AUR and nixpkgs (not to mention future fedora/COPR/deb packages) would need updated to vendor a private libcurl with our patch applied.

  1. is there a way to tolerate this error without digging into libcurl itself?
  2. can we ask upstream libcurl if they'd be more receptive to an upstream 'tolerate naughty servers' toggle at this point in time?

ADKaster avatar Dec 12 '25 19:12 ADKaster

imo this should just be upstreamed (as a proper flag, not "ladybird quirks mode").

alimpfard avatar Dec 13 '25 11:12 alimpfard

Agree with Ali. To pull this in, I'd hope for

  1. a separate commit pulling in libcurl as-is from vcpkg, to better determine what is "upstream port" and what is "ladybird changes" when looking at commit history

  2. upstreamable patch with links to curl discussions or PR

Given that bagder seems positive about ladybird using libcurl, hopefully a series of patches related to "browser quirks" will be more likely to be accepted now than when the referenced discussions happened.

ADKaster avatar Dec 13 '25 19:12 ADKaster