File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/aiohttp/__pycache__/_cookie_helpers.cpython-310.pyc
Back
o ;j7 � @ s d Z ddlZddlmZ ddlmZmZ ddlmZ ddl m Z dZe�d �Z ed �Zed�Ze�dejejB �Zd ee dee fdd�Ze�d�jZdeje defdd�Zdedefdd�Zdedeeeee f fdd�Zdee deeeee f fdd�ZdS )z� Internal cookie handling helpers. This module contains internal utilities for cookie parsing and manipulation. These are not part of the public API and may change without notice. � N)�Sequence)�CookieError�Morsel)�cast� )�internal_logger)�parse_set_cookie_headers�parse_cookie_header� preserve_morsel_with_coded_valuez.^[!#$%&\'()*+\-./0-9:<=>?@A-Z\[\]^_`a-z{|}~]+$) �path�domainzmax-ageZexpires�secure�httponlyZsamesite�partitioned�versionZcomment)r r r a� \s* # Optional whitespace at start of cookie (?P<key> # Start of group 'key' # aiohttp has extended to include [] for compatibility with real-world cookies [\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\[\]]+ # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P<val> # Start of group 'val' "(?:[^\\"]|\\.)*" # Any double-quoted string (properly closed) | # or "[^";]* # Unmatched opening quote (differs from SimpleCookie - issue #7993) | # or # Special case for "expires" attr - RFC 822, RFC 850, RFC 1036, RFC 1123 (\w{3,6}day|\w{3}),\s # Day of the week or abbreviated day (with comma) [\w\d\s-]{9,11}\s[\d:]{8}\s # Date and time in specific format (GMT|[+-]\d{4}) # Timezone: GMT or RFC 2822 offset like -0000, +0100 # NOTE: RFC 2822 timezone support is an aiohttp extension # for issue #4493 - SimpleCookie does NOT support this | # or # ANSI C asctime() format: "Wed Jun 9 10:18:14 2021" # NOTE: This is an aiohttp extension for issue #4327 - SimpleCookie does NOT support this format \w{3}\s+\w{3}\s+[\s\d]\d\s+\d{2}:\d{2}:\d{2}\s+\d{4} | # or [\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=\[\]]* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. �cookie�returnc C sL t d| �| jt� ��}z|�| j| j| jd�� W |S ty% | Y S w )a^ Preserve a Morsel's coded_value exactly as received from the server. This function ensures that cookie encoding is preserved exactly as sent by the server, which is critical for compatibility with old servers that have strict requirements about cookie formats. This addresses the issue described in https://github.com/aio-libs/aiohttp/pull/1453 where Python's SimpleCookie would re-encode cookies, breaking authentication with certain servers. Args: cookie: A Morsel object from SimpleCookie Returns: A Morsel object with preserved coded_value zMorsel[str]��key�value�coded_value)r �getr r �__setstate__r r r )r Zmrsl_val� r �K/opt/saltstack/salt/lib/python3.10/site-packages/aiohttp/_cookie_helpers.pyr U s �� ��r z\\(?:([0-3][0-7][0-7])|(.))�mc C s"