Deprecate and remove http.client.HTTPMessage.getallmatchingheaders()
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando http.client.HTTPMessage.getallmatchingheaders() ed esamina il lavoro collegato in gh-153649, insieme al precedente consumer CGIHTTPRequestHandler menzionato nell’issue. Il lavoro sarà completato quando il metodo sarà deprecato per Python 3.16 e rimosso in 3.18, senza rimuovere la classe HTTPMessage documentata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Refactoring
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 25/100