gh-139434: Update selected RFC 2822 references to RFC 5322 (#139435)

Update selected RFC 2822 references to RFC 5322

RFC 2822 was obsoleted by RFC 5322 in 2008. This updates references
to use the current standard in documentation, docstrings, and comments.

It preserves RFC 2822 references in legacy API components to maintain their
historical context.

RFC 822 → RFC 2822 → RFC 5322 progression is explained where relevant.

In some places specific sections of RFC are referenced where it seems helpful.

Scout rule was applied in some places and RFC mentions format was
normalized in doc strings and comments.
This commit is contained in:
Filip Łajszczak 2025-11-04 20:46:07 +01:00 committed by GitHub
parent 97d8dda980
commit ce1bb85d28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 49 additions and 45 deletions

View file

@ -231,7 +231,7 @@ def _read_headers(fp, max_headers):
def _parse_header_lines(header_lines, _class=HTTPMessage):
"""
Parses only RFC2822 headers from header lines.
Parses only RFC 5322 headers from header lines.
email Parser wants to see strings rather than bytes.
But a TextIOWrapper around self.rfile would buffer too many bytes
@ -244,7 +244,7 @@ def _parse_header_lines(header_lines, _class=HTTPMessage):
return email.parser.Parser(_class=_class).parsestr(hstring)
def parse_headers(fp, _class=HTTPMessage, *, _max_headers=None):
"""Parses only RFC2822 headers from a file pointer."""
"""Parses only RFC 5322 headers from a file pointer."""
headers = _read_headers(fp, _max_headers)
return _parse_header_lines(headers, _class)