hyb
2026-01-30 7657e1b2fa251a2ea372710ad75cb395a3c0e374
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Ë
¸^i­6ãóÀ—dZddlZddlmZddlmZmZmZmZm    Z    ddl
m Z dZ ejd«Zed    «Zed
«Zejd ej$ej&z«Zd eed eefd„Zejd«j.Zdej2ed efd„Zded efd„Zded eeeeeffd„Zdeed eeeeeffd„Zy)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)ÚMorsel)ÚListÚOptionalÚSequenceÚTupleÚcasté)Úinternal_logger)Úparse_set_cookie_headersÚparse_cookie_headerÚ preserve_morsel_with_coded_valuez.^[!#$%&\'()*+\-./0-9:<=>?@A-Z\[\]^_`a-z{|}~]+$)
ÚpathÚdomainzmax-ageÚexpiresÚsecureÚhttponlyÚsamesiteÚ partitionedÚversionÚcomment)rrraà
    \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óȗtd|j|jt«««}|j    |j|j
|j dœ«|S)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
 
    z Morsel[str]©ÚkeyÚvalueÚ coded_value)rÚgetrrÚ __setstate__rr)rÚmrsl_vals  õjH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\aiohttp/_cookie_helpers.pyr r TsP€ô&M 6§:¡:¨f¯j©j¼&»(Ó#CÓD€Hð
 ×ÑØ—
‘
 V§\¡\À&×BTÑBTÑUôð €Oóz\\(?:([0-3][0-7][0-7])|(.))ÚmcóF—|drtt|dd««S|dS)zþ
    Replace function for _unquote_sub regex substitution.
 
    Handles escaped characters in cookie values:
    - Octal sequences are converted to their character representation
    - Other escaped characters are unescaped by removing the backslash
    r    éé)ÚchrÚint)r#s r!Ú_unquote_replacer)us)€ð    ˆ‚tÜ”3q˜‘t˜Q“<Ó Ð Ø ˆQ‰4€Kr"rcóp—t|«dkr|S|ddk7s|ddk7r|S|dd}tt|«S)zõ
    Unquote a cookie value.
 
    Vendored from http.cookies._unquote to ensure compatibility.
 
    Note: The original implementation checked for None, but we've removed
    that check since all callers already ensure the value is not None.
    r&rú"éÿÿÿÿr    )ÚlenÚ _unquote_subr))rs r!Ú_unquoter/‚sL€ô ˆ5ƒzA‚~؈ Ø ˆQx3‚˜% ™) sÒ*؈ ð !BˆK€Eô Ô(¨%Ó 0Ð0r"ÚheadercóŠ—|sgSg}d}t|«}g}||krtj||«}|sÔ|jd|«}|jd|«}|dk7rž|dk(s||kr”|dk7r|n|}|||j    «}    ||dz|j    «}
t
j|    «s|j |    «n;t«} | j|    t|
«|
dœ«|j |    | f«|dk7r|dzn|}Œò|jd«}    |jd«xsd    }
|jd«}|    rt
j|    «s|j |    «ŒSt«} | j|    t|
«|
dœ«|j |    | f«||krŒ|rtjd
|«|S) a
    Parse a Cookie header according to RFC 6265 Section 5.4.
 
    Cookie headers contain only name-value pairs separated by semicolons.
    There are no attributes in Cookie headers - even names that match
    attribute names (like 'path' or 'secure') should be treated as cookies.
 
    This parser uses the same regex-based approach as parse_set_cookie_headers
    to properly handle quoted values that may contain semicolons. When the
    regex fails to match a malformed cookie, it falls back to simple parsing
    to ensure subsequent cookies are not lost
    https://github.com/aio-libs/aiohttp/issues/11632
 
    Args:
        header: The Cookie header value to parse
 
    Returns:
        List of (name, Morsel) tuples for compatibility with SimpleCookie.update()
    rú;ú=r,r    rrÚvalÚz,Cannot load cookie. Illegal cookie names: %r)r-Ú_COOKIE_PATTERNÚmatchÚfindÚstripÚ_COOKIE_NAME_REÚappendrrr/ÚgroupÚendr
Údebug) r0ÚcookiesÚiÚnÚ invalid_namesr7Ú    next_semiÚeq_posÚend_posrrÚmorsels             r!r r ŸsЀñ( ؈    à-/€Gà    €AÜ ˆF‹ €Aà€MØ
ˆa‹%ä×%Ñ% f¨aÓ0ˆÙ🠙  C¨Ó+ˆIØ—[‘[  aÓ(ˆFð˜Š| ¨b¢°F¸YÒ4FØ'0°B¢™)¸AØ˜Q˜vÐ&×,Ñ,Ó.Ø˜v¨™z¨GÐ4×:Ñ:Ó<ô'×,Ñ,¨SÔ1Ø!×(Ñ(¨Õ-ä#›XFØ×'Ñ'Ø #¬h°u«oÈeÑTôð—N‘N C¨ =Ô1ð"+¨b¢    ˜A’ °aˆAØ àk‰k˜%Ó ˆØ— ‘ ˜EÓ"Ò( bˆØ I‰Ia‹Lˆñœ/×/Ñ/°Ô4Ø ×  Ñ   Ô %Ù ô“ˆð     ×ÑØ¤(¨5£/À%Ñ Hô    
ð    ‰˜˜V}Ô%ðc ˆaŒ%ñfÜ×ÑØ :¸Mô    
ð €Nr"Úheaderscóò—g}|D]n}|sŒd}t|«}d}d}d|cxkr|ksŒ$nŒ'tj||«}|sŒ@|jd«|jd«}    }|j    d«}|j «}
|ddk(r|sŒv|Ï|
dd} | t vrÂ|    xsd|| <n¸|
t vr8|sŒ²|
tvr|£|j|«r’d    ||
<nŒ|    €ŒÖ|‡t|    «||
<nx|    t|t vstj|«stjd
|«d}n@t«}|j|t|    «|    d œ«|j||f«d    }nŒ_d|cxkr|krŒEŒnŒq|S) aé
    Parse cookie headers using a vendored version of SimpleCookie parsing.
 
    This implementation is based on SimpleCookie.__parse_string to ensure
    compatibility with how SimpleCookie parses cookies, including handling
    of malformed cookies with missing semicolons.
 
    This function is used for both Cookie and Set-Cookie headers in order to be
    forgiving. Ideally we would have followed RFC 6265 Section 5.2 (for Cookie
    headers) and RFC 6265 Section 4.2.1 (for Set-Cookie headers), but the
    real world data makes it impossible since we need to be a bit more forgiving.
 
    NOTE: This implementation differs from SimpleCookie in handling unmatched quotes.
    SimpleCookie will stop parsing when it encounters a cookie value with an unmatched
    quote (e.g., 'cookie="value'), causing subsequent cookies to be silently dropped.
    This implementation handles unmatched quotes more gracefully to prevent cookie loss.
    See https://github.com/aio-libs/aiohttp/issues/7993
    rNFrr4ú$r    r5Tz,Can not load cookies: Illegal cookie name %rr)r-r6r7r<r=ÚlowerÚ_COOKIE_KNOWN_ATTRSÚ_COOKIE_BOOL_ATTRSÚ isReservedKeyr/r:r
Úwarningrrr;) rGÚparsed_cookiesr0r@rAÚcurrent_morselÚ morsel_seenr7rrÚ    lower_keyÚattr_lower_keys             r!r r ÷s´€ð&57€NàóDˆÙØ ð ˆÜ ‹KˆØ04ˆØˆ à1ŒjqŽjä#×)Ñ)¨&°!Ó4ˆEÙààŸ™ UÓ+¨U¯[©[¸Ó-?ˆCØ—    ‘    ˜!“ ˆAØŸ    ™    › ˆIà1‰v˜Š}Ù"ðà!Ð-Ø%.¨q¨r ]NØ%Ô)<Ñ<Ø9>ºÀ"˜ ~Ò6ØÔ1Ñ1Ù"àØÔ 2Ñ2à%Ð1°n×6RÑ6RÐSVÔ6WØ48˜ yÒ1ؐ]àØ#Ð/ä08¸³N 9Ò-ØÐ"ðÔ-Ñ-´_×5JÑ5JÈ3Ô5OÜ#×+Ñ+ØFÈôð&*‘Nô&,£XNð #×/Ñ/Ø #¬h°u«oÈeÑTôð#×)Ñ)¨3°Ð*?Ô@Ø"&‘Kñðu1Œjqj‰jðDðL Ðr")Ú__doc__ÚreÚ http.cookiesrÚtypingrrrrrÚlogr
Ú__all__Úcompiler:Ú    frozensetrKrLÚVERBOSEÚASCIIr6Ústrr Úsubr.ÚMatchr)r/r r ©r"r!ú<module>rbs8ðñó
Ýß8Õ8å ð €ð"—*‘*ÐNÓO€Ùð ó ÐñØ)óÐð"—*‘*ðð<‡JJ—‘Ñó? €ðF¨V°C©[ð¸VÀC¹[óð<ˆrz‰zÐ8Ó9×=Ñ=€ ð
˜Ÿ™ ™ ð
¨#ó
ð1Cð1˜Có1ð:U ðU¨¨U°3¸¸s¹ Ð3CÑ-DÑ(EóUðp[ h¨s¡mð[¸¸UÀ3ÈÈsÉ ÐCSÑ=TÑ8Uô[r"