python / python/cpython

Deprecate and remove http.client.HTTPMessage.getallmatchingheaders()

Abierto
#153,648 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

stdlib type-feature
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

Splitting this out of #49303, as @hugovk suggested there.

HTTPMessage.getallmatchingheaders() has returned [] for every input since Python 3.0. It compares self.keys() entries against "name:", but keys() returns header names without the colon, so nothing ever matches:

>>> msg = email.parser.Parser(_class=http.client.HTTPMessage).parsestr("Set-Cookie: a=1\r\n")
>>> msg.get_all("Set-Cookie")
['a=1']
>>> msg.getallmatchingheaders("Set-Cookie")
[]

Its only consumer was CGIHTTPRequestHandler, which @picnixz removed in 3.15 (#133810). The method is undocumented and untested, and since it has never returned anything, no working code can depend on its output — so removing it carries no real compatibility risk.

The older patch on #49303 went further and dropped the whole HTTPMessage class, but that one is a documented public type (it's what response.headers is), so I'd suggest keeping this issue to the method.

Proposal: deprecate in 3.16, remove in 3.18. Happy to send the PR if that's the direction.

Linked PRs
  • gh-153649

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Comienza localizando http.client.HTTPMessage.getallmatchingheaders() y revisa el trabajo relacionado en gh-153649, junto con el antiguo consumidor CGIHTTPRequestHandler mencionado en el issue. Se considerará terminado cuando el método quede obsoleto para Python 3.16 y se elimine en 3.18 sin eliminar la clase HTTPMessage documentada.

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

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Refactorización
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.