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

@ -146,8 +146,9 @@ def _parsedate_tz(data):
return None
# Check for a yy specified in two-digit format, then convert it to the
# appropriate four-digit format, according to the POSIX standard. RFC 822
# calls for a two-digit yy, but RFC 2822 (which obsoletes RFC 822)
# mandates a 4-digit yy. For more information, see the documentation for
# calls for a two-digit yy, but RFC 2822 (which obsoletes RFC 822) already
# mandated a 4-digit yy, and RFC 5322 (which obsoletes RFC 2822) continues
# this requirement. For more information, see the documentation for
# the time module.
if yy < 100:
# The year is between 1969 and 1999 (inclusive).
@ -233,9 +234,11 @@ def __init__(self, field):
self.CR = '\r\n'
self.FWS = self.LWS + self.CR
self.atomends = self.specials + self.LWS + self.CR
# Note that RFC 2822 now specifies '.' as obs-phrase, meaning that it
# is obsolete syntax. RFC 2822 requires that we recognize obsolete
# syntax, so allow dots in phrases.
# Note that RFC 2822 section 4.1 introduced '.' as obs-phrase to handle
# existing practice (periods in display names), even though it was not
# allowed in RFC 822. RFC 5322 section 4.1 (which obsoletes RFC 2822)
# continues this requirement. We must recognize obsolete syntax, so
# allow dots in phrases.
self.phraseends = self.atomends.replace('.', '')
self.field = field
self.commentlist = []