HTTP header list parsing does not accept empty list elements

Abierto
#1,396 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
scala

Línea de trabajo

Start with the list parsing rules used by HttpHeader.parse and compare them with Range’s existing handling of leading empty elements. Check downstream handling of unrecognized Connection headers, especially whether close is honored. Done when leading, interior, and trailing empty elements parse as required across list headers, the all-empty case is decided for required lists, and tests cover these cases.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

RFC 9110 §5.6.1 (previously RFC 7230 §7) says a recipient must parse and ignore a reasonable number of empty list elements. Most header list rules use oneOrMore(...).separatedBy(listSep) or the zeroOrMore equivalent, which does not allow them, so these headers are not parsed into their modeled types and stay RawHeaders:

Header Value
Cache-Control no-store,, public
Cache-Control , no-store, public
Cache-Control no-store, public,
Connection close,, foo
Allow GET,, POST
If-None-Match "a",, "b"
Accept text/plain,, text/html

These were found by parsing each value with HttpHeader.parse. They are a sample, and other headers using the same rules are likely to behave the same way. Range already tolerates leading empty elements with zeroOrMore(ws(',')).

Things to look at:

  • Interior, leading and trailing empty elements all need handling, so this probably means changing each list rule or adding a shared helper, not only listSep.
  • Decide how a list with no elements at all (for example Cache-Control: ,) should behave for headers that require at least one.
  • Check what happens downstream when a header stays a RawHeader, starting with Connection, since a close that is not recognised could change connection handling.

Follow-up to #1395, which fixes whitespace before the list separator but does not change how empty elements are handled.

Lenguaje dominante
Scala
Estrellas
199
Forks
57
Merge medio
1 d 20 h
PR fusionados (30 d)
54

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/pekko-http

Todos los issues de apache/pekko-http

Issues similares

Más issues de Scala

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.