http2: content-encoding is incorrectly listed in kSingleValueHeaders
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- backend, networking
Línea de trabajo
Lee lib/internal/http2/util.js y céntrate en kSingleValueHeaders y en las rutas mapToHeaders y buildNgHeaderString. Comprueba cómo se gestionan los valores content-encoding duplicados en cada dirección; el trabajo está terminado cuando los valores entrantes se combinan en orden y varios valores salientes ya no provocan ERR_HTTP2_HEADER_SINGLE_VALUE.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version
v26.13.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Drafted by Gemini 4 Argon.
In lib/internal/http2/util.js, HTTP2_HEADER_CONTENT_ENCODING is listed in kSingleValueHeaders:
- Incoming (
mapToHeaders): When an HTTP/2 peer sends multiplecontent-encodingheader lines (e.g.,content-encoding: gziptwice on Google Drive viewer endpoints), only the first value is kept inheaders['content-encoding']and subsequent values are silently dropped (even withstrictSingleValueFields: falsefrom #59917). As a result, HTTP/2 clients only decompress the first layer and treat the still-compressed payload as decoded data, and reverse proxies forwardingheadersstrip the remaining encoding layers so downstream browsers fail to decode the response. - Outgoing (
buildNgHeaderString): Passing multiplecontent-encodingvalues throwsERR_HTTP2_HEADER_SINGLE_VALUEby default, preventing servers and proxies from sending or forwarding multi-valuecontent-encodingheaders.
Evidence
-
HTTP Semantics — RFC 9110 §8.4 (
Content-Encoding) & §5.3:Content-Encoding = #content-codingIf one or more encodings have been applied to a representation, the sender that applied the encodings MUST generate a Content-Encoding header field that lists the content codings in the order in which they were applied.
Because
Content-Encodinguses the#elementlist ABNF production, multiplecontent-encodingheader field lines are valid per RFC 9110 §5.3 and must be combined in order with', 'rather than discarded. -
HTTP/2 & HPACK — RFC 9113 §8.2.1 & RFC 7541:
HTTP/2 only forbids connection-specific headers (connection,transfer-encoding,keep-alive,upgrade,proxy-connection); for all other fields, RFC 9113 §8.2.1 inherits RFC 9110 §5.3, allowing list-based headers to be transmitted as multiple separate HPACK header field entries (each referencing HPACK static table index 26content-encoding).nghttp2itself accepts multiplecontent-encodingentries and delivers all of them inrawHeaders—the truncation happens purely in Node's JSkSingleValueHeaderscheck. -
node:httpconsistency:lib/_http_incoming.js(_addHeaderLine) does not treatcontent-encodingas single-value and joins duplicate lines with', '.
Removing HTTP2_HEADER_CONTENT_ENCODING from kSingleValueHeaders fixes both directions.
Compatibility
- No type change:
headers['content-encoding']remainsstring | undefined(mapToHeadersjoins non-single-value headers with', '), and singlecontent-encodingresponses are unaffected. - Incoming duplicate headers:
headers['content-encoding']becomes'gzip, br'instead of'gzip'(matching what a singlecontent-encoding: gzip, brheader ornode:httpalready produces). Callers doing exact single-token checks (headers['content-encoding'] === 'gzip') without splitting on','may stop matching when a peer sends multiple lines. - Outgoing validation: Passing multiple
content-encodingvalues will succeed instead of throwingERR_HTTP2_HEADER_SINGLE_VALUE(potentiallysemver-majorper Node's error-removal policy).
How often does it reproduce? Is there a required condition?
What is the expected behavior? Why is that the expected behavior?
What do you see instead?
Additional information
No response
- Lenguaje dominante
- JavaScript
- Estrellas
- 123k
- Forks
- 39.3k
- Merge medio
- 4 d 15 h
- PR fusionados (30 d)
- 238
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nodejs/node
-
util: parseArgs() treats a `-` inside a short option group as the `--` terminatorPosiblemente ocupada @yohannesjoya la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
util.parseEnv and --env-file keep a leading UTF-8 BOM in the first keyPosiblemente ocupada @helmipradita la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
node:internal/inspector/network_http: `TypeError: Missing dataLength` in event when response uses `setEncoding()`Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nodejs/node#66551 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Docs] `process.loadEnvFile()` does not document behaviour when variables already existPosiblemente ocupada @Sepandard la tomó hace 38 días. Abiertodoc
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
Stream.prototype.forEach will block in first promise in queue before read more chunkPosiblemente ocupada @mmustafasenoglu la tomó hace 39 días. Abiertodoc
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
Todos los issues de nodejs/node
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
riverqueue/river#1576 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
good first issue help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
modrollstudio/Modroll-Studio-Website#80 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add tests for CSV email parsingAbiertogood first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
mafzalkalwardev/mailforge#21 ·
-
good first issue help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100