Skip to content

Unsupported-encoding passthrough forwards encoded body with content-encoding stripped (found during #661 triage) #677

Description

@ranxianglei

Found while triaging #661 (not the cause of that 405 — filing per policy so it isn't lost).

Problem

In the #619 "unsupported encoding" path, src/server.ts forwards the still-encoded body bytes, but the content-encoding header is stripped as hop-by-hop (UPSTREAM_HOP_HEADERS, src/server.ts:208-227). Upstream receives gzip/br/deflate bytes declared as none → 400-class failures.

Also the comment near src/server.ts:1003 ("content-encoding header stays intact") contradicts the actual behavior — headers in UPSTREAM_HOP_HEADERS are stripped on forward.

Expected

Either:

  • forward the body decoded (decode → strip header — consistent), or
  • forward the raw bytes with content-encoding preserved on this path.

Repro sketch

Upstream advertises Accept-Encoding: br; client sends content-encoding: gzip body through a path that bili does not decode (unsupported encoding per #619); observe upstream rejecting undeclared binary body.

Priority

Low-medium: only bites clients that send request bodies with encodings bili doesn't decode. Discovered by ework during #661 PR #664 triage; independently confirmed in code reading.

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions