Skip to content

gh-153648: Deprecate http.client.HTTPMessage.getallmatchingheaders() - #153649

Open
soreavis wants to merge 2 commits into
python:mainfrom
soreavis:deprecate-getallmatchingheaders
Open

soreavis wants to merge 2 commits into
python:mainfrom
soreavis:deprecate-getallmatchingheaders

Conversation

@soreavis

@soreavis soreavis commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

getallmatchingheaders() has returned an empty list for every input since Python 3.0 — it compares keys() entries, which are bare header names, against "name:". Its only user was the CGI handler, which was removed in 3.15, and run_cgi() had already stopped calling it in 3.10.

Deprecate it, with removal in 3.18. That is PEP 387's minimum window rather than the usual five years, on the grounds that the method has never worked and has had no callers for five releases — happy to push it out to 3.21 if you'd rather keep it in line with the other 3.16 deprecations.

Use email.message.Message.get_all() instead.

#153648

…ers()

getallmatchingheaders() has returned an empty list for every input since
Python 3.0 -- it compares keys() entries, which are bare header names,
against "name:".  Its only user was the CGI handler, removed in 3.15, and
run_cgi() had already stopped calling it in 3.10.

Deprecate it, with removal in 3.18.  Use email.message.Message.get_all()
instead.
@read-the-docs-community

Copy link
Copy Markdown

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good but just a nit.

Comment thread Lib/http/client.py
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants