-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-105622: Parse HTTP headers with default email policy #105918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
gh-105622: Parse HTTP headers with default email policy #105918
Conversation
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.
@vstinner, probably? |
The following commit authors need to sign the Contributor License Agreement: |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
Is this change backward incompatible? |
Updates
http.client._parse_header_lines
to useemail.policy.default
when parsing HTTP headers. An email policy should always be specified and allows the http module to use email's header registry.http.client
to use default email policy for parsing #105622📚 Documentation preview 📚: https://cpython-previews--105918.org.readthedocs.build/