Skip to content

Conversation

@lovesegfault
Copy link
Member

Motivation

Nix failed to download files served with Content-Encoding: x-gzip
because libarchive doesn't recognize the legacy x-* compression
format names. Per RFC 9110 §8.4.1.3, HTTP recipients should treat
these as equivalent to their standard counterparts.

Adds normalizeCompressionMethod() to map legacy encoding names
before passing to libarchive:

  • x-gzipgzip
  • x-compresscompress
  • x-bzip2bzip2

Context

Fixes: #14324


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Nix failed to download files served with `Content-Encoding: x-gzip`
because libarchive doesn't recognize the legacy `x-*` compression
format names. Per RFC 9110 §8.4.1.3, HTTP recipients should treat
these as equivalent to their standard counterparts.

Adds `normalizeCompressionMethod()` to map legacy encoding names
before passing to libarchive:
- `x-gzip` → `gzip`
- `x-compress` → `compress`
- `x-bzip2` → `bzip2`
Copy link
Contributor

@xokdvium xokdvium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that what we should do is stop using strings to represent enumeration types. We confuse compression algorithm name used by libarxhive and our non-standard Content-Enxoding headers. Those need to become clearly separated

@Mic92
Copy link
Member

Mic92 commented Oct 29, 2025

I think that what we should do is stop using strings to represent enumeration types. We confuse compression algorithm name used by libarxhive and our non-standard Content-Enxoding headers. Those need to become clearly separated

you mean libarchive has enum types for compression?

@xokdvium
Copy link
Contributor

libarchive has enum types for compression?

It doesn't unfortunately, but we really should have our own to wrap around libarchive.

@Ericson2314
Copy link
Member

I agree that making our own enum sounds like the right call.

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.

Content-Encoding: x-gzip should be supported

4 participants