Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

http.cookies module does not parse obsolete RFC 850 date format #123401

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@Konano

Description

@Konano

Bug report

Bug description:

Description: According toRFC 9110, a recipient that parses a timestamp value in an HTTP field MUST accept all three HTTP-date formats. This includes the obsolete RFC 850 format, e.g.,Sunday, 06-Nov-94 08:49:37 GMT. However, the Python standard library modulehttp.cookies currently fails to parse this format, which leads to the cookie being discarded entirely.

Steps to Reproduce:

  1. Attempt to parse a cookie with a date in the obsolete RFC 850 format using thehttp.cookies module.
  2. Observe that the module fails to parse the date, resulting in the cookie being discarded.

Code Example:

importhttp.cookiescookie_string='example=value; expires=Sunday, 06-Nov-94 08:49:37 GMT'cookie=http.cookies.SimpleCookie()cookie.load(cookie_string)# The expected behavior is that the cookie's expiration date is correctly parsed.# However, the module fails to parse the date in the obsolete RFC 850 format,# resulting in the cookie being discarded.print(cookie['example'].get('expires'))

Expected Behavior:
Thehttp.cookies module should correctly parse the obsolete RFC 850 date format and retain the cookie.

Actual Behavior:
The module fails to parse the date, resulting in aKeyError and the cookie being discarded.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp