Skip to content

gh-105622: Parse HTTP headers with default email policy#105918

Closed
michaelfm1211 wants to merge 3 commits into
python:mainfrom
michaelfm1211:parse-http-headers-with-default-email-policy
Closed

gh-105622: Parse HTTP headers with default email policy#105918
michaelfm1211 wants to merge 3 commits into
python:mainfrom
michaelfm1211:parse-http-headers-with-default-email-policy

Conversation

@michaelfm1211

@michaelfm1211 michaelfm1211 commented Jun 19, 2023

Copy link
Copy Markdown

Updates http.client._parse_header_lines to use email.policy.default when parsing HTTP headers. An email policy should always be specified and allows the http module to use email's header registry.


📚 Documentation preview 📚: https://cpython-previews--105918.org.readthedocs.build/

Updates http.client._parse_header_lines to use email.policy.default when
parsing HTTP headers. An email policy should always be specified and
allows the http module to use email's header registry.
@arhadthedev

Copy link
Copy Markdown
Member

@vstinner, probably?

@python-cla-bot

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA signed

@vstinner vstinner 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.

Can you add some examples of headers previously accepted and no longer accepted by the new policy? Add them to tests.

self.fail('Date value not in %r format' % dateformat)
date = fileheaders.get('Date')
self.assertIsInstance(date, email.headerregistry.DateHeader,
"Date is not an instance of email.headerregistery.DateHeader")

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.

I don't think that the 3rd argument is needed.

@vstinner

Copy link
Copy Markdown
Member

Is this change backward incompatible?

@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 13, 2026
@vstinner

Copy link
Copy Markdown
Member

The CLA was not signed and my review from last year was not addressed. I close the PR.

@vstinner vstinner closed this Apr 30, 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. topic-email

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants