HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/alt/python311/lib64/python3.11/http/__pycache__/cookies.cpython-311.pyc
�

�0�iQ����dZddlZddlZddlZgd�ZdjZdjZdjZGd�de	��Z
ejejzd	zZ
e
d
zZd�eed����eeee����z
D��Ze�ed
��ded��di��ejdeje
��z��jZejd��Zd�Zd�Zejd��jZd�Zd�Zgd�Z gd�Z!de e!fd�Z"Gd�de#��Z$dZ%e%dzZ&ejde%zd ze&zd!zej'ej(z��Z)Gd"�d#e#��Z*Gd$�d%e*��Z+dS)&a%

Here's a sample session to show how to use this module.
At the moment, this is the only documentation.

The Basics
----------

Importing is easy...

   >>> from http import cookies

Most of the time you start by creating a cookie.

   >>> C = cookies.SimpleCookie()

Once you've created your Cookie, you can add values just as if it were
a dictionary.

   >>> C = cookies.SimpleCookie()
   >>> C["fig"] = "newton"
   >>> C["sugar"] = "wafer"
   >>> C.output()
   'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer'

Notice that the printable representation of a Cookie is the
appropriate format for a Set-Cookie: header.  This is the
default behavior.  You can change the header and printed
attributes by using the .output() function

   >>> C = cookies.SimpleCookie()
   >>> C["rocky"] = "road"
   >>> C["rocky"]["path"] = "/cookie"
   >>> print(C.output(header="Cookie:"))
   Cookie: rocky=road; Path=/cookie
   >>> print(C.output(attrs=[], header="Cookie:"))
   Cookie: rocky=road

The load() method of a Cookie extracts cookies from a string.  In a
CGI script, you would use this method to extract the cookies from the
HTTP_COOKIE environment variable.

   >>> C = cookies.SimpleCookie()
   >>> C.load("chips=ahoy; vienna=finger")
   >>> C.output()
   'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger'

The load() method is darn-tootin smart about identifying cookies
within a string.  Escaped quotation marks, nested semicolons, and other
such trickeries do not confuse it.

   >>> C = cookies.SimpleCookie()
   >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=;";')
   >>> print(C)
   Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=;"

Each element of the Cookie also supports all of the RFC 2109
Cookie attributes.  Here's an example which sets the Path
attribute.

   >>> C = cookies.SimpleCookie()
   >>> C["oreo"] = "doublestuff"
   >>> C["oreo"]["path"] = "/"
   >>> print(C)
   Set-Cookie: oreo=doublestuff; Path=/

Each dictionary element has a 'value' attribute, which gives you
back the value associated with the key.

   >>> C = cookies.SimpleCookie()
   >>> C["twix"] = "none for you"
   >>> C["twix"].value
   'none for you'

The SimpleCookie expects that all values should be standard strings.
Just to be sure, SimpleCookie invokes the str() builtin to convert
the value to a string, when the values are set dictionary-style.

   >>> C = cookies.SimpleCookie()
   >>> C["number"] = 7
   >>> C["string"] = "seven"
   >>> C["number"].value
   '7'
   >>> C["string"].value
   'seven'
   >>> C.output()
   'Set-Cookie: number=7\r\nSet-Cookie: string=seven'

Finis.
�N)�CookieError�
BaseCookie�SimpleCookie�z; � c��eZdZdS)rN)�__name__�
__module__�__qualname__���3/opt/alt/python311/lib64/python3.11/http/cookies.pyrr�s�������Dr
rz!#$%&'*+-.^_`|~:z
 ()/<=>?@[]{}c��i|]}|d|z��	S)z\%03or)�.0�ns  r�
<dictcomp>r�s4��J�J�J���(�Q�,�J�J�Jr
��"�\"�\z\\z[%s]+z[\x00-\x1F\x7F]c�4�td�|D����S)zhDetects control characters within a value.
    Supports any type, as header values can be any type.
    c3�dK�|]+}t�t|����V��,dS�N)�_control_character_re�search�str)r�vs  r�	<genexpr>z)_has_control_character.<locals>.<genexpr>�s7����A�A��$�+�+�C��F�F�3�3�A�A�A�A�A�Ar
)�any)�vals r�_has_control_characterr!�s!���A�A�S�A�A�A�A�A�Ar
c�h�|�t|��r|Sd|�t��zdzS)z�Quote a string for use in a cookie header.

    If the string does not need to be double-quoted, then just return the
    string.  Otherwise, surround the string in doublequotes and quote
    (with a \) special characters.
    Nr)�
_is_legal_key�	translate�_Translator�rs r�_quoter'�s6���{�m�C�(�(�{��
��S�]�]�;�/�/�/�#�5�5r
z\\(?:([0-3][0-7][0-7])|(.))c�h�|dr#tt|dd����S|dS)N���)�chr�int)�ms r�_unquote_replacer/�s1����t���3�q��t�Q�<�<� � � ���t�r
c��|�t|��dkr|S|ddks|ddkr|S|dd�}tt|��S)Nr+rr���r))�len�_unquote_subr/r&s r�_unquoter4�s\���{�c�#�h�h��l�l��
�
�1�v��}�}��B��3����
��a��d�)�C��(�#�.�.�.r
)�Mon�Tue�Wed�Thu�Fri�Sat�Sun)
N�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decc	��ddlm}m}|��}|||z��\	}}}}	}
}}}
}d|||||||	|
|fzS)Nr)�gmtime�timez#%s, %02d %3s %4d %02d:%02d:%02d GMT)rJrI)�future�weekdayname�	monthnamerIrJ�now�year�month�day�hh�mm�ss�wd�y�zs               r�_getdaterX�su��!�!�!�!�!�!�!�!�
�$�&�&�C�-3�V�C�&�L�-A�-A�*�D�%��b�"�b�"�a��0���O�S�)�E�"2�D�"�b�"�E�F�Fr
c
��eZdZdZdddddddd	d
d�	Zdd
hZd�Zed���Zed���Z	ed���Z
d�Zd!d�Zd�Z
ejZd�Zd�Zd�Zd�Zd�Zd�Zd"d�ZeZd�Zd!d�Zd!d �Zeej��ZdS)#�MorselaCA class to hold ONE (key, value) pair.

    In a cookie, each such pair may have several attributes, so this class is
    used to keep the attributes associated with the appropriate key,value pair.
    This class also includes a coded_value attribute, which is used to hold
    the network representation of the value.
    �expires�Path�Comment�DomainzMax-Age�Secure�HttpOnly�Version�SameSite)	r[�path�comment�domain�max-age�secure�httponly�version�samesitergrhc�|�dx|_x|_|_|jD]}t�||d���dS)Nr)�_key�_value�_coded_value�	_reserved�dict�__setitem__)�self�keys  r�__init__zMorsel.__init__sP��6:�:��	�:�D�K�$�"3��>�	,�	,�C����T�3��+�+�+�+�	,�	,r
c��|jSr)rl�rrs rrsz
Morsel.key s
���y�r
c��|jSr)rmrvs r�valuezMorsel.value$s
���{�r
c��|jSr)rnrvs r�coded_valuezMorsel.coded_value(s��� � r
c���|���}||jvrtd|�����t||��rtd|�d|�����t�|||��dS�N�Invalid attribute �.Control characters are not allowed in cookies r)�lowerrorr!rprq)rr�K�Vs   rrqzMorsel.__setitem__,s���
�G�G�I�I���D�N�"�"��+���;�<�<�<�!�!�Q�'�'�	\��Z�q�Z�Z�UV�Z�Z�[�[�[�����q�!�$�$�$�$�$r
Nc���|���}||jvrtd|�����t||��rtd|�d|�����t�|||��Sr|)rrorr!rp�
setdefault)rrrsr s   rr�zMorsel.setdefault4sz���i�i�k�k���d�n�$�$��+���=�>�>�>�!�#�s�+�+�	c��+�WZ�WZ�WZ�\_�\_�a�b�b�b����t�S�#�.�.�.r
c���t|t��stSt�||��o/|j|jko|j|jko|j|jkSr)�
isinstancerZ�NotImplementedrp�__eq__rmrlrn�rr�morsels  rr�z
Morsel.__eq__<sg���&�&�)�)�	"�!�!����D�&�)�)�9���v�}�,�9��	�V�[�(�9��!�V�%8�8�	:r
c��t��}t�||��|j�|j��|Sr)rZrp�update�__dict__r�s  r�copyzMorsel.copyFs<���������F�D�!�!�!�����t�}�-�-�-��
r
c��i}t|�����D]9\}}|���}||jvrt	d|�����|||<�:t�||��dS)Nr})rp�itemsrrorr�)rr�values�datarsr s     rr�z
Morsel.updateLs������V���*�*�,�,�	�	�H�C���)�)�+�+�C��$�.�(�(�!�k�C�C�"A�B�B�B��D��I�I����D�$�����r
c�8�|���|jvSr)rro)rrr�s  r�
isReservedKeyzMorsel.isReservedKeyUs���w�w�y�y�D�N�*�*r
c��|���|jvrtd|�����t|��std|�����t	|||��rtd|�d|�d|�����||_||_||_dS)NzAttempt to set a reserved key zIllegal key r~r)rrorr#r!rlrmrn)rrrsr �	coded_vals    r�setz
Morsel.setXs����9�9�;�;�$�.�(�(��+�C�C�I�J�J�J��S�!�!�	9��+�#�#�7�8�8�8�!�#�s�I�6�6�	c��+�LO�C�C�QT�QT�QT�V_�V_�a�c�c�
c���	����%����r
c�,�|j|j|jd�S)N)rsrxrz�rlrmrnrvs r�__getstate__zMorsel.__getstate__fs!���9��[��,�
�
�	
r
c�T�|d|_|d|_|d|_dS)Nrsrxrzr�)rr�states  r�__setstate__zMorsel.__setstate__ms+���%�L��	��G�n���!�-�0����r
�Set-Cookie:c�6�|�d|�|����S)Nr)�OutputString)rr�attrs�headers   r�outputz
Morsel.outputrs"�� �&�&�$�"3�"3�E�":�":�":�;�;r
c�L�d|jj�d|����d�S)N�<�: �>)�	__class__r	r�rvs r�__repr__zMorsel.__repr__ws,���!�^�4�4�4�d�6G�6G�6I�6I�6I�6I�J�Jr
c�Z�d|�|���dd��zS)Nz�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "%s";
        // end hiding -->
        </script>
        rr)r��replace)rrr�s  r�	js_outputzMorsel.js_outputzs4���� � ��'�'�/�/��U�;�;�
=�	=r
c��g}|j}||j�d|j����|�|j}t	|�����}|D�]\}}|dkr�
||vr�|dkr>t
|t��r)||j|�dt|�������V|dkr1t
|t��r|d|j||fz����|dkr>t
|t��r)||j|�dt|��������||jvr'|r#|t|j|������||j|�d|������t|��S)N�=rr[rfz%s=%drd)
�appendrsrzro�sortedr�r�r-rXrr'�_flags�_semispacejoin)rrr��resultr�r�rsrxs       rr�zMorsel.OutputString�s��������	��$�(�(�(�D�$4�$4�5�6�6�6��=��N�E��t�z�z�|�|�$�$���	?�	?�J�C����{�{���%�����i���J�u�c�$:�$:����$�.��"5�"5�"5�x�����G�H�H�H�H��	�!�!�j���&<�&<�!���w�$�.��"5�u�!=�=�>�>�>�>��	�!�!�j���&<�&<�!���$�.��"5�"5�"5�v�e�}�}�}�E�F�F�F�F����#�#��5��F�3�t�~�c�2�3�3�4�4�4����$�.��"5�"5�"5�u�u�=�>�>�>�>��f�%�%�%r
r)Nr�)r	r
r�__doc__ror�rt�propertyrsrxrzrqr�r��object�__ne__r�r�r�r�r�r�r��__str__r�r�r��classmethod�types�GenericAlias�__class_getitem__rr
rrZrZ�s���������*���������
�
�I��
�
#�F�,�,�,�����X������X���!�!��X�!�%�%�%�/�/�/�/�:�:�:��]�F���� � � �+�+�+�&�&�&�
�
�
�1�1�1�
<�<�<�<��G�K�K�K�=�=�=�=�&�&�&�&�B$��E�$6�7�7���r
rZz,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z�
    \s*                            # Optional whitespace at start of cookie
    (?P<key>                       # Start of group 'key'
    [a	]+?   # 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 doublequoted string
    |                                  # or
    \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT  # Special case for "expires" attr
    |                                  # or
    [a-]*      # 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.
    c�\�eZdZdZd�Zd�Zdd�Zd�Zd�Zdd
�Z	e	Z
d�Zdd�Zd
�Z
efd�ZdS)rz'A container class for a set of Morsels.c�
�||fS)a
real_value, coded_value = value_decode(STRING)
        Called prior to setting a cookie's value from the network
        representation.  The VALUE is the value read from HTTP
        header.
        Override this function to modify the behavior of cookies.
        r�rrr s  r�value_decodezBaseCookie.value_decode�s
���C�x�r
c�(�t|��}||fS)z�real_value, coded_value = value_encode(VALUE)
        Called prior to setting a cookie's value from the dictionary
        representation.  The VALUE is the value being assigned.
        Override this function to modify the behavior of cookies.
        r&�rrr �strvals   r�value_encodezBaseCookie.value_encode�s���S�����v�~�r
Nc�8�|r|�|��dSdSr)�load)rr�inputs  rrtzBaseCookie.__init__�s,���	��I�I�e������	�	r
c��|�|t����}|�|||��t�|||��dS)z+Private method for setting a cookie's valueN)�getrZr�rprq)rrrs�
real_valuerz�Ms     r�__setzBaseCookie.__set�sM���H�H�S�&�(�(�#�#��	���c�:�{�+�+�+�����s�A�&�&�&�&�&r
c���t|t��rt�|||��dS|�|��\}}|�|||��dS)zDictionary style assignment.N)r�rZrprqr��_BaseCookie__set)rrrsrx�rval�cvals     rrqzBaseCookie.__setitem__�se���e�V�$�$�	(����T�3��.�.�.�.�.��*�*�5�1�1�J�D�$��J�J�s�D�$�'�'�'�'�'r
r��
c��g}t|�����}|D]N\}}|�||��}t|��rt	d���|�|���O|�|��S)z"Return a string suitable for HTTP.z-Control characters are not allowed in cookies)r�r�r�r!rr��join)	rrr�r��sepr�r�rsrx�value_outputs	         rr�zBaseCookie.output�s������t�z�z�|�|�$�$���	(�	(�J�C�� �<�<��v�6�6�L�%�l�3�3�
S�!�"Q�R�R�R��M�M�,�'�'�'�'��x�x����r
c���g}t|�����}|D]1\}}|�|�dt|j�������2d|jj�dt|���d�S)Nr�r�r�r�)r�r�r��reprrxr�r	�
_spacejoin)rr�lr�rsrxs     rr�zBaseCookie.__repr__�s�����t�z�z�|�|�$�$���	9�	9�J�C��
�H�H����T�%�+�%6�%6�%6�7�8�8�8�8�	9�!�^�4�4�4�j��m�m�m�m�D�Dr
c���g}t|�����}|D]-\}}|�|�|�����.t	|��S)z(Return a string suitable for JavaScript.)r�r�r�r��	_nulljoin)rrr�r�r�rsrxs      rr�zBaseCookie.js_outputs^�����t�z�z�|�|�$�$���	2�	2�J�C���M�M�%�/�/�%�0�0�1�1�1�1��� � � r
c��t|t��r|�|��n|���D]
\}}|||<�dS)z�Load cookies from a string (presumably HTTP_COOKIE) or
        from a dictionary.  Loading cookies from a dictionary 'd'
        is equivalent to calling:
            map(Cookie.__setitem__, d.keys(), d.values())
        N)r�r�_BaseCookie__parse_stringr�)rr�rawdatarsrxs    rr�zBaseCookie.loadsZ���g�s�#�#�	"�����(�(�(�(�&�m�m�o�o�
"�
"�
��U�!��S�	�	��r
c��d}t|��}g}d}d}d}d|cxkr|k�rVn�nR|�||��}	|	s�n8|	�d��|	�d��}}
|	�d��}|
ddkr$|s�z|�||
dd�|f��n�|
���tjvrg|sdS|�;|
���tjvr|�||
df��nZdS|�||
t|��f��n2|�.|�||
|�
|��f��d}ndSd|cxkr|k��Pnd}|D]B\}
}
}|
|kr
|�J�|||
<�|
|ksJ�|\}}|�|
||��||
}�CdS)	NrFr)r+rsr �$T)r2�match�group�endr�rrZror�r4r�r�)rrr�patt�ir�parsed_items�morsel_seen�TYPE_ATTRIBUTE�
TYPE_KEYVALUEr�rsrxr��tpr�r�s                r�__parse_stringzBaseCookie.__parse_strings-��
����H�H���������
�
�1�j�j�j�j�q�j�j�j�j�j��J�J�s�A�&�&�E��
�����U�+�+�U�[�[��-?�-?��C��	�	�!���A��1�v��}�}�"����#�#�^�S����W�e�$D�E�E�E�E������� 0�0�0�"���F��=��y�y�{�{�f�m�3�3�$�+�+�^�S�$�,G�H�H�H�H��� �'�'���h�u�o�o�(N�O�O�O�O��"��#�#�]�C��9J�9J�5�9Q�9Q�$R�S�S�S�"�����E�1�j�j�j�j�q�j�j�j�j�J
��*�	�	�N�B��U��^�#�#��}�}�}���#����]�*�*�*�*�"�
��d��
�
�3��d�+�+�+���I���	�	r
r)Nr�r�)r	r
rr�r�r�rtr�rqr�r�r�r�r��_CookiePatternr�rr
rrr�s�������1�1�����������'�'�'�(�(�(�	 �	 �	 �	 ��G�E�E�E�!�!�!�!����(6�:�:�:�:�:�:r
rc��eZdZdZd�Zd�ZdS)rz�
    SimpleCookie supports strings as cookie values.  When setting
    the value using the dictionary assignment notation, SimpleCookie
    calls the builtin str() to convert the value to a string.  Values
    received from HTTP are kept as strings.
    c�$�t|��|fSr)r4r�s  rr�zSimpleCookie.value_decode`s����}�}�c�!�!r
c�B�t|��}|t|��fSr)rr'r�s   rr�zSimpleCookie.value_encodecs���S�����v�f�~�~�%�%r
N)r	r
rr�r�r�rr
rrrYs<��������"�"�"�&�&�&�&�&r
r),r��re�stringr��__all__r�r�r�r��	Exceptionr�
ascii_letters�digits�_LegalChars�_UnescapedCharsr��range�map�ordr%r��compile�escape�	fullmatchr#rr!r'�subr3r/r4�_weekdayname�
_monthnamerXrprZ�_LegalKeyChars�_LegalValueChars�ASCII�VERBOSEr�rrrr
r�<module>rs���NX�X�z
�	�	�	�
�
�
�
�����
7�
7�
7���G�	����
�X�
�
	�	�	�	�	�)�	�	�	�"�"�V�]�2�5G�G����/��J�J���E�E�#�J�J���#�#�c�c�#��.G�.G�*H�*H�H�J�J�J������C��H�H�e��C��I�I�v�����
��
�7�Y�R�Y�{�%;�%;�;�<�<�F�
�"��
�#5�6�6��B�B�B�
6�
6�
6��r�z�8�9�9�=�����/�/�/�6A�@�@��8�8�8�
��<�:�F�F�F�F�p8�p8�p8�p8�p8�T�p8�p8�p8�xB��!�G�+�����	���		�	�����"
��B�J�	�# � ��.L�L�L�L�L��L�L�L�^&�&�&�&�&�:�&�&�&�&�&r