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
Splitting this out of #49303, as @hugovk suggested there.
HTTPMessage.getallmatchingheaders()has returned[]for every input since Python 3.0. It comparesself.keys()entries against"name:", butkeys()returns header names without the colon, so nothing ever matches: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
HTTPMessageclass, but that one is a documented public type (it's whatresponse.headersis), 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