Skip to content

http.cookies | RFC2109 is obsolete. #92012

@SmartManoj

Description

@SmartManoj

cpython/Lib/http/cookies.py

Lines 262 to 285 in 37c6db6

# RFC 2109 lists these attributes as reserved:
# path comment domain
# max-age secure version
#
# For historical reasons, these attributes are also reserved:
# expires
#
# This is an extension from Microsoft:
# httponly
#
# This dictionary provides a mapping from the lowercase
# variant on the left to the appropriate traditional
# formatting on the right.
_reserved = {
"expires" : "expires",
"path" : "Path",
"comment" : "Comment",
"domain" : "Domain",
"max-age" : "Max-Age",
"secure" : "Secure",
"httponly" : "HttpOnly",
"version" : "Version",
"samesite" : "SameSite",
}

RFC2109 is obsolete.
RFC6265 has only the following headers
Expires
Max-Age
Domain
Path
Secure
HttpOnly

from http.cookies import SimpleCookie
rawdata = 'version=4'
cookie = SimpleCookie()
import http.cookies
cookie.load(rawdata)
print(cookie) # empty ;  expected {'version': '4'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions